Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(Interval.after(DateTime.utc(), Duration.fromObject({ year: 1 })): Interval);
(Interval.after(DateTime.utc(), { year: 1 }): Interval);
(Interval.after(DateTime.utc(), 1231234): Interval);
(Interval.after(
{ year: 2017, month: 1 },
Duration.fromObject({ year: 1 })
): Interval);
(Interval.after({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.after({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.before(DateTime.utc(), Duration.fromObject({ year: 1 })): Interval);
(Interval.before(DateTime.utc(), { year: 1 }): Interval);
(Interval.before(DateTime.utc(), 1231234): Interval);
(Interval.before(
{ year: 2017, month: 1 },
Duration.fromObject({ year: 1 })
): Interval);
(Interval.before({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.before({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.fromDateTimes(DateTime.utc(), DateTime.utc()): Interval);
(Interval.fromDateTimes(DateTime.utc(), { year: 2017, month: 1 }): Interval);
(Interval.fromDateTimes({ year: 2016, month: 1 }, DateTime.utc()): Interval);
(Interval.after(DateTime.utc(), Duration.fromObject({ year: 1 })): Interval);
(Interval.after(DateTime.utc(), { year: 1 }): Interval);
(Interval.after(DateTime.utc(), 1231234): Interval);
(Interval.after(
{ year: 2017, month: 1 },
Duration.fromObject({ year: 1 })
): Interval);
(Interval.after({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.after({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.before(DateTime.utc(), Duration.fromObject({ year: 1 })): Interval);
(Interval.before(DateTime.utc(), { year: 1 }): Interval);
(Interval.before(DateTime.utc(), 1231234): Interval);
(Interval.before(
{ year: 2017, month: 1 },
Duration.fromObject({ year: 1 })
): Interval);
(Interval.before({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.before({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.fromDateTimes(DateTime.utc(), DateTime.utc()): Interval);
(Interval.fromDateTimes(DateTime.utc(), { year: 2017, month: 1 }): Interval);
(Interval.fromDateTimes({ year: 2016, month: 1 }, DateTime.utc()): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.before(DateTime.utc(), Duration.fromObject({ year: 1 })): Interval);
(Interval.before(DateTime.utc(), { year: 1 }): Interval);
(Interval.before(DateTime.utc(), 1231234): Interval);
(Interval.before(
{ year: 2017, month: 1 },
Duration.fromObject({ year: 1 })
): Interval);
(Interval.before({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.before({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.fromDateTimes(DateTime.utc(), DateTime.utc()): Interval);
(Interval.fromDateTimes(DateTime.utc(), { year: 2017, month: 1 }): Interval);
(Interval.fromDateTimes({ year: 2016, month: 1 }, DateTime.utc()): Interval);
(Interval.fromDateTimes(
{ year: 2016, month: 1 },
{ year: 2017, month: 1 }
): Interval);
(Interval.fromDateTimes(
// $ExpectError
{ year: 2016, month: 1, foo: 'bar' },
{ year: 2017, month: 1 }
): Interval);
(Interval.fromDateTimes(
{ year: 2016, month: 1 },
// $ExpectError
(Interval.after({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.after({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.before(DateTime.utc(), Duration.fromObject({ year: 1 })): Interval);
(Interval.before(DateTime.utc(), { year: 1 }): Interval);
(Interval.before(DateTime.utc(), 1231234): Interval);
(Interval.before(
{ year: 2017, month: 1 },
Duration.fromObject({ year: 1 })
): Interval);
(Interval.before({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.before({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.fromDateTimes(DateTime.utc(), DateTime.utc()): Interval);
(Interval.fromDateTimes(DateTime.utc(), { year: 2017, month: 1 }): Interval);
(Interval.fromDateTimes({ year: 2016, month: 1 }, DateTime.utc()): Interval);
(Interval.fromDateTimes(
{ year: 2016, month: 1 },
{ year: 2017, month: 1 }
): Interval);
(Interval.fromDateTimes(
// $ExpectError
{ year: 2016, month: 1, foo: 'bar' },
{ year: 2017, month: 1 }
(Interval.after(DateTime.utc(), 1231234): Interval);
(Interval.after(
{ year: 2017, month: 1 },
Duration.fromObject({ year: 1 })
): Interval);
(Interval.after({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.after({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.before(DateTime.utc(), Duration.fromObject({ year: 1 })): Interval);
(Interval.before(DateTime.utc(), { year: 1 }): Interval);
(Interval.before(DateTime.utc(), 1231234): Interval);
(Interval.before(
{ year: 2017, month: 1 },
Duration.fromObject({ year: 1 })
): Interval);
(Interval.before({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.before({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.fromDateTimes(DateTime.utc(), DateTime.utc()): Interval);
(Interval.fromDateTimes(DateTime.utc(), { year: 2017, month: 1 }): Interval);
(Interval.fromDateTimes({ year: 2016, month: 1 }, DateTime.utc()): Interval);
(Interval.fromDateTimes(
{ year: 2016, month: 1 },
{ year: 2017, month: 1 }
(Interval.after(DateTime.utc(), { year: 1 }): Interval);
(Interval.after(DateTime.utc(), 1231234): Interval);
(Interval.after(
{ year: 2017, month: 1 },
Duration.fromObject({ year: 1 })
): Interval);
(Interval.after({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.after({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.before(DateTime.utc(), Duration.fromObject({ year: 1 })): Interval);
(Interval.before(DateTime.utc(), { year: 1 }): Interval);
(Interval.before(DateTime.utc(), 1231234): Interval);
(Interval.before(
{ year: 2017, month: 1 },
Duration.fromObject({ year: 1 })
): Interval);
(Interval.before({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.before({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.fromDateTimes(DateTime.utc(), DateTime.utc()): Interval);
(Interval.fromDateTimes(DateTime.utc(), { year: 2017, month: 1 }): Interval);
(Interval.fromDateTimes({ year: 2016, month: 1 }, DateTime.utc()): Interval);
(Interval.fromDateTimes(
{ year: 2016, month: 1 },
(Interval.after(DateTime.utc(), Duration.fromObject({ year: 1 })): Interval);
(Interval.after(DateTime.utc(), { year: 1 }): Interval);
(Interval.after(DateTime.utc(), 1231234): Interval);
(Interval.after(
{ year: 2017, month: 1 },
Duration.fromObject({ year: 1 })
): Interval);
(Interval.after({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.after({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.before(DateTime.utc(), Duration.fromObject({ year: 1 })): Interval);
(Interval.before(DateTime.utc(), { year: 1 }): Interval);
(Interval.before(DateTime.utc(), 1231234): Interval);
(Interval.before(
{ year: 2017, month: 1 },
Duration.fromObject({ year: 1 })
): Interval);
(Interval.before({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.before({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.fromDateTimes(DateTime.utc(), DateTime.utc()): Interval);
(Interval.fromDateTimes(DateTime.utc(), { year: 2017, month: 1 }): Interval);
(Interval.fromDateTimes({ year: 2016, month: 1 }, DateTime.utc()): Interval);
(Interval.fromDateTimes(
// $ExpectError
(Interval.after({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.before(DateTime.utc(), Duration.fromObject({ year: 1 })): Interval);
(Interval.before(DateTime.utc(), { year: 1 }): Interval);
(Interval.before(DateTime.utc(), 1231234): Interval);
(Interval.before(
{ year: 2017, month: 1 },
Duration.fromObject({ year: 1 })
): Interval);
(Interval.before({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.before({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.fromDateTimes(DateTime.utc(), DateTime.utc()): Interval);
(Interval.fromDateTimes(DateTime.utc(), { year: 2017, month: 1 }): Interval);
(Interval.fromDateTimes({ year: 2016, month: 1 }, DateTime.utc()): Interval);
(Interval.fromDateTimes(
{ year: 2016, month: 1 },
{ year: 2017, month: 1 }
): Interval);
(Interval.fromDateTimes(
// $ExpectError
{ year: 2016, month: 1, foo: 'bar' },
{ year: 2017, month: 1 }
): Interval);
(Interval.fromDateTimes(
{ year: 2016, month: 1 },
// $ExpectError
(Interval.after(DateTime.utc(), Duration.fromObject({ year: 1 })): Interval);
(Interval.after(DateTime.utc(), { year: 1 }): Interval);
(Interval.after(DateTime.utc(), 1231234): Interval);
(Interval.after(
{ year: 2017, month: 1 },
Duration.fromObject({ year: 1 })
): Interval);
(Interval.after({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.after({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.after({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.before(DateTime.utc(), Duration.fromObject({ year: 1 })): Interval);
(Interval.before(DateTime.utc(), { year: 1 }): Interval);
(Interval.before(DateTime.utc(), 1231234): Interval);
(Interval.before(
{ year: 2017, month: 1 },
Duration.fromObject({ year: 1 })
): Interval);
(Interval.before({ year: 2017, month: 1 }, { year: 1 }): Interval);
(Interval.before({ year: 2017, month: 1 }, 123123): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1, foo: "bar" }, { year: 1 }): Interval);
// $ExpectError
(Interval.before({ year: 2017, month: 1 }, { year: 1, foo: "bar" }): Interval);
(Interval.fromDateTimes(DateTime.utc(), DateTime.utc()): Interval);
(Interval.fromDateTimes(DateTime.utc(), { year: 2017, month: 1 }): Interval);
(Interval.fromDateTimes({ year: 2016, month: 1 }, DateTime.utc()): Interval);
(Interval.fromDateTimes(
it('Interval.before takes a number and unit', () => {
let end = Instant.fromObject({year: 2016, month: 5, day: 25}),
int = Interval.before(end, 3, 'days');
expect(int.start().day()).toBe(22);
expect(int.end()).toBe(end);
});
};