<commit_before>import { DateTime, Duration, Interval, Info, Settings, IANAZone, Zone, ZoneOffsetOptions } from 'luxon';

/* DateTime */
const dt = DateTime.local(2017, 5, 15, 8, 30);

const now = DateTime.local();

const fromObject = DateTime.fromObject({
    month: 4,
    day: 22,
    hour: 12,
    zone: 'America/Los_Angeles',
    numberingSystem: 'beng'
});

const ianaZone = new IANAZone('America/Los_Angeles');
const ianaZoneTest = DateTime.fromObject({
    zone: ianaZone
});

const fromIso = DateTime.fromISO('2017-05-15'); // => May 15, 2017 at midnight
const fromIso2 = DateTime.fromISO('2017-05-15T08:30:00'); // => May 15, 2017 at midnight

DateTime.local().toString(); // => '2017-09-14T03:20:34.091-04:00'

const getters = DateTime.local();
getters.year;
getters.month;
getters.day;
getters.second;
getters.weekday;
getters.zoneName;
getters.offset;
getters.daysInMonth;
getters.ordinal;
getters.isInLeapYear;

dt.toBSON(); // $ExpectType Date
dt.toHTTP(); // $ExpectType string
dt.toISO(); // $ExpectType string
dt.toISO({ includeOffset: true }); // $ExpectType string
dt.toISODate(); // $ExpectType string
dt.toISOTime(); // $ExpectType string
dt.toISOWeekDate(); // $ExpectType string
dt.toJSDate(); // $ExpectType Date
dt.toJSON(); // $ExpectType string
dt.toLocaleString(); // $ExpectType string
dt.toLocaleString({ month: 'long', day: 'numeric' }); // $ExpectType string
dt.toLocaleString(DateTime.DATE_MED); // $ExpectType string
dt.toMillis(); // $ExpectType number
dt.toMillis(); // $ExpectType number
dt.toRelative(); // $ExpectType string | null
dt.toRelativeCalendar(); // $ExpectType string | null
dt.toRFC2822(); // $ExpectType string
dt.toSeconds(); // $ExpectType number
dt.toSQL(); // $ExpectType string
dt.toSQL({ includeOffset: false, includeZone: true }); // $ExpectType string
dt.toSQLDate(); // $ExpectType string
dt.toSQLTime(); // $ExpectType string
dt.toSQLTime({ includeOffset: false, includeZone: true }); // $ExpectType string
dt.valueOf(); // $ExpectType number

// $ExpectType string | null
dt.toRelative({
    base: DateTime.local(),
    locale: 'fr',
    style: 'long',
    unit: 'day',
    round: true,
    padding: 10,
    numberingSystem: 'bali',
});

// $ExpectType string | null
dt.toRelativeCalendar({
    base: DateTime.local(),
    locale: 'fr',
    unit: 'day',
    numberingSystem: 'bali',
});

dt.plus({ hours: 3, minutes: 2 });
dt.minus({ days: 7 });
dt.startOf('day');
dt.endOf('hour');
dt.zone;
dt.zoneName; // $ExpectType string
dt.offset; // $ExpectType number
dt.offsetNameShort; // $ExpectType string
dt.offsetNameLong; // $ExpectType string
dt.isOffsetFixed; // $ExpectType boolean
dt.isInDST; // $ExpectType boolean

dt.set({ hour: 3 }).hour; // $ExpectType number

const f = { month: 'long', day: 'numeric' };
dt.setLocale('fr').toLocaleString(f);
dt.setLocale('en-GB').toLocaleString(f);
dt.setLocale('en-US').toLocaleString(f);

DateTime.local().setZone('America/Los_Angeles');

DateTime.utc(2017, 5, 15); // $ExpectType DateTime
DateTime.utc(); // $ExpectType DateTime
DateTime.local().toUTC(); // $ExpectType DateTime
DateTime.utc().toLocal(); // $ExpectType DateTime

DateTime.max(dt, now); // $ExpectType DateTime
DateTime.min(dt, now); // $ExpectType DateTime

const anything: any = 0;
if (DateTime.isDateTime(anything)) {
    anything; // $ExpectType DateTime
}

const { input, result, zone } = DateTime.fromFormatExplain('Aug 6 1982', 'MMMM d yyyy');

/* Duration */
const dur = Duration.fromObject({ hours: 2, minutes: 7 });
dt.plus(dur); // $ExpectType DateTime
dt.plus({ quarters: 2, month: 1 }); // $ExpectType DateTime
dur.hours; // $ExpectType number
dur.minutes; // $ExpectType number
dur.seconds; // $ExpectType number

dur.as('seconds'); // $ExpectType number
dur.toObject();
dur.toISO(); // $ExpectType string
dur.normalize(); // $ExpectType Duration

if (Duration.isDuration(anything)) {
    anything; // $ExpectType Duration
}

/* Interval */
const later = DateTime.local();
const i = Interval.fromDateTimes(now, later);
i.length(); // $ExpectType number
i.length('years'); // $ExpectType number
i.contains(DateTime.local(2019)); // $ExpectType boolean
i.set({end: DateTime.local(2020)}); // $ExpectType Interval
i.mapEndpoints((d) => d); // $ExpectType Interval

i.toISO(); // $ExpectType string
i.toString(); // $ExpectType string
i.toDuration('months'); // $ExpectType Duration
i.toDuration(); // $ExpectType Duration

if (Interval.isInterval(anything)) {
    anything; // $ExpectType Interval
}

/* Info */
Info.months();
Info.weekdays('long');
Info.features().intl;
Info.features().intlTokens;
Info.features().zones;

/* Settings */
Settings.defaultLocale;<commit_msg>Add tests for intersection<commit_after>import { DateTime, Duration, Interval, Info, Settings, IANAZone, Zone, ZoneOffsetOptions } from 'luxon';

/* DateTime */
const dt = DateTime.local(2017, 5, 15, 8, 30);

const now = DateTime.local();

const fromObject = DateTime.fromObject({
    month: 4,
    day: 22,
    hour: 12,
    zone: 'America/Los_Angeles',
    numberingSystem: 'beng'
});

const ianaZone = new IANAZone('America/Los_Angeles');
const ianaZoneTest = DateTime.fromObject({
    zone: ianaZone
});

const fromIso = DateTime.fromISO('2017-05-15'); // => May 15, 2017 at midnight
const fromIso2 = DateTime.fromISO('2017-05-15T08:30:00'); // => May 15, 2017 at midnight

DateTime.local().toString(); // => '2017-09-14T03:20:34.091-04:00'

const getters = DateTime.local();
getters.year;
getters.month;
getters.day;
getters.second;
getters.weekday;
getters.zoneName;
getters.offset;
getters.daysInMonth;
getters.ordinal;
getters.isInLeapYear;

dt.toBSON(); // $ExpectType Date
dt.toHTTP(); // $ExpectType string
dt.toISO(); // $ExpectType string
dt.toISO({ includeOffset: true }); // $ExpectType string
dt.toISODate(); // $ExpectType string
dt.toISOTime(); // $ExpectType string
dt.toISOWeekDate(); // $ExpectType string
dt.toJSDate(); // $ExpectType Date
dt.toJSON(); // $ExpectType string
dt.toLocaleString(); // $ExpectType string
dt.toLocaleString({ month: 'long', day: 'numeric' }); // $ExpectType string
dt.toLocaleString(DateTime.DATE_MED); // $ExpectType string
dt.toMillis(); // $ExpectType number
dt.toMillis(); // $ExpectType number
dt.toRelative(); // $ExpectType string | null
dt.toRelativeCalendar(); // $ExpectType string | null
dt.toRFC2822(); // $ExpectType string
dt.toSeconds(); // $ExpectType number
dt.toSQL(); // $ExpectType string
dt.toSQL({ includeOffset: false, includeZone: true }); // $ExpectType string
dt.toSQLDate(); // $ExpectType string
dt.toSQLTime(); // $ExpectType string
dt.toSQLTime({ includeOffset: false, includeZone: true }); // $ExpectType string
dt.valueOf(); // $ExpectType number

// $ExpectType string | null
dt.toRelative({
    base: DateTime.local(),
    locale: 'fr',
    style: 'long',
    unit: 'day',
    round: true,
    padding: 10,
    numberingSystem: 'bali',
});

// $ExpectType string | null
dt.toRelativeCalendar({
    base: DateTime.local(),
    locale: 'fr',
    unit: 'day',
    numberingSystem: 'bali',
});

dt.plus({ hours: 3, minutes: 2 });
dt.minus({ days: 7 });
dt.startOf('day');
dt.endOf('hour');
dt.zone;
dt.zoneName; // $ExpectType string
dt.offset; // $ExpectType number
dt.offsetNameShort; // $ExpectType string
dt.offsetNameLong; // $ExpectType string
dt.isOffsetFixed; // $ExpectType boolean
dt.isInDST; // $ExpectType boolean

dt.set({ hour: 3 }).hour; // $ExpectType number

const f = { month: 'long', day: 'numeric' };
dt.setLocale('fr').toLocaleString(f);
dt.setLocale('en-GB').toLocaleString(f);
dt.setLocale('en-US').toLocaleString(f);

DateTime.local().setZone('America/Los_Angeles');

DateTime.utc(2017, 5, 15); // $ExpectType DateTime
DateTime.utc(); // $ExpectType DateTime
DateTime.local().toUTC(); // $ExpectType DateTime
DateTime.utc().toLocal(); // $ExpectType DateTime

DateTime.max(dt, now); // $ExpectType DateTime
DateTime.min(dt, now); // $ExpectType DateTime

const anything: any = 0;
if (DateTime.isDateTime(anything)) {
    anything; // $ExpectType DateTime
}

const { input, result, zone } = DateTime.fromFormatExplain('Aug 6 1982', 'MMMM d yyyy');

/* Duration */
const dur = Duration.fromObject({ hours: 2, minutes: 7 });
dt.plus(dur); // $ExpectType DateTime
dt.plus({ quarters: 2, month: 1 }); // $ExpectType DateTime
dur.hours; // $ExpectType number
dur.minutes; // $ExpectType number
dur.seconds; // $ExpectType number

dur.as('seconds'); // $ExpectType number
dur.toObject();
dur.toISO(); // $ExpectType string
dur.normalize(); // $ExpectType Duration

if (Duration.isDuration(anything)) {
    anything; // $ExpectType Duration
}

/* Interval */
const later = DateTime.local();
const i = Interval.fromDateTimes(now, later);
i.length(); // $ExpectType number
i.length('years'); // $ExpectType number
i.contains(DateTime.local(2019)); // $ExpectType boolean
i.set({end: DateTime.local(2020)}); // $ExpectType Interval
i.mapEndpoints((d) => d); // $ExpectType Interval
i.intersection(i); // $ExpectType Interval | null

i.toISO(); // $ExpectType string
i.toString(); // $ExpectType string
i.toDuration('months'); // $ExpectType Duration
i.toDuration(); // $ExpectType Duration

if (Interval.isInterval(anything)) {
    anything; // $ExpectType Interval
}

/* Info */
Info.months();
Info.weekdays('long');
Info.features().intl;
Info.features().intlTokens;
Info.features().zones;

/* Settings */
Settings.defaultLocale;
{'fraction_non_alphanumeric': 0.17709110282365476, 'fraction_numerical': 0.022589238145977623, 'mean_word_length': 4.453805926786752, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '91458', 'n_tokens_mistral': 3238, 'n_tokens_neox': 3050, 'n_words': 748}