How to use the luxon.Instant.fromISO function in luxon

To help you get started, we’ve selected a few luxon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github moment / luxon / test / interval / info.js View on Github external
it('Interval#isBefore returns true for intervals fully before the input', () => {
    let n = Instant.fromISO('1982-05-25T06:00'),
        i = Interval.fromInstants(n.minus(2, 'day'), n.minus(1, 'day'));
    expect(i.isBefore(n)).toBeTruthy();
  });
github moment / luxon / test / interval / info.js View on Github external
it('Interval#isAfter returns false for intervals containing the input', () => {
    let n = Instant.fromISO('1982-05-25T06:00'),
        i = Interval.fromInstants(n.minus(2, 'day'), n.plus(2, 'day'));
    expect(i.isAfter(n)).toBeFalsy();
  });
github moment / luxon / test / interval / info.js View on Github external
it('Interval#contains returns false for instants after the interval', () => {
    let i = fromISOs('1982-05-25T06:00', '1982-05-25T07:00');
    expect(i.contains(Instant.fromISO('1982-05-25T08:30'))).toBeFalsy();
  });
github moment / luxon / test / interval / info.js View on Github external
it("Interval#count('days') returns 2 if the interval crosses midnight", () => {
    let i = Instant.fromISO('2016-05-25T03:00').until(Instant.fromISO('2016-05-26T14:00'));
    expect(i.count('days')).toBe(2);
  });
github moment / luxon / test / interval / info.js View on Github external
it('Interval#contains returns false for instants before the interval', () => {
    let i = fromISOs('1982-05-25T06:00', '1982-05-25T07:00');
    expect(i.contains(Instant.fromISO('1982-05-25T05:30'))).toBeFalsy();
  });
github moment / luxon / test / interval / info.js View on Github external
it("Interval#count('days') returns 1 inside a day", () => {
    let i = Instant.fromISO('2016-05-25T03:00').until(Instant.fromISO('2016-05-25T14:00'));
    expect(i.count('days')).toBe(1);
  });
github moment / luxon / test / interval / info.js View on Github external
it('Interval#isAfter returns true for intervals fully after the input', () => {
    let n = Instant.fromISO('1982-05-25T06:00'),
        i = Interval.fromInstants(n.plus(1, 'day'), n.plus(2, 'day'));
    expect(i.isAfter(n)).toBeTruthy();
  });
github moment / luxon / test / instant / parse.js View on Github external
it('Instant.fromISO() parses as local by default', () => {
    let inst = Instant.fromISO("2016-05-25T09:08:34.123");
    expect(inst.toObject()).toEqual(
      {year: 2016, month: 5, day: 25, hour: 9, minute: 8, second: 34, millisecond: 123}
    );
  });
github moment / luxon / test / instant / parse.js View on Github external
    let rejects = (s) => expect(Instant.fromISO(s).isValid()).toBeFalsy();
github moment / luxon / test / interval / info.js View on Github external
  let fromISOs = (s, e, opts = {}) => Instant.fromISO(s).until(Instant.fromISO(e), opts),
      todayAt = (h) => Instant.now().startOf('day').hour(h),