How to use the luxon.Info.months 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 flow-typed / flow-typed / definitions / npm / luxon_v1.x.x / flow_v0.104.x- / test_luxon.js View on Github external
(Info.eras("long", { locale: "de-DE" }): Array);
// $ExpectError
(Info.eras("long", { foo: "bar" }): Array);

(Info.features().intl: boolean);
(Info.features().intlTokens: boolean);
(Info.features().timezones: boolean);

(Info.hasDST("America/Chicago"): boolean);
(Info.hasDST(new CustomZone()): boolean);

(Info.meridiems(): Array);
(Info.meridiems({ locale: "de-DE" }): Array);

(Info.months("long"): Array);
(Info.months("narrow", { locale: "de-DE" }): Array);
(Info.months("short", { numberingSystem: "arab" }): Array);
(Info.months("2-digit", {
  numberingSystem: "latn",
  outputCalendar: "buddhist"
}): Array);
// $ExpectError
(Info.months("long", { foo: "bar" }): Array);

(Info.monthsFormat("long"): Array);
(Info.monthsFormat("narrow", { locale: "de-DE" }): Array);
(Info.monthsFormat("short", { numberingSystem: "arab" }): Array);
(Info.monthsFormat("2-digit", {
  numberingSystem: "latn",
  outputCalendar: "buddhist"
}): Array);
// $ExpectError
github flow-typed / flow-typed / definitions / npm / luxon_v0.2.x / flow_v0.104.x- / test_luxon.js View on Github external
(Info.eras("long", { locale: "de-DE" }): Array);
// $ExpectError
(Info.eras("long", { foo: "bar" }): Array);

(Info.features().intl: boolean);
(Info.features().intlTokens: boolean);
(Info.features().timezones: boolean);

(Info.hasDST("America/Chicago"): boolean);
(Info.hasDST(new CustomZone()): boolean);

(Info.meridiems(): Array);
(Info.meridiems({ locale: "de-DE" }): Array);

(Info.months("long"): Array);
(Info.months("narrow", { locale: "de-DE" }): Array);
(Info.months("short", { numberingSystem: "arab" }): Array);
(Info.months("2-digit", {
  numberingSystem: "latn",
  outputCalendar: "buddhist"
}): Array);
// $ExpectError
(Info.months("long", { foo: "bar" }): Array);

(Info.monthsFormat("long"): Array);
(Info.monthsFormat("narrow", { locale: "de-DE" }): Array);
(Info.monthsFormat("short", { numberingSystem: "arab" }): Array);
(Info.monthsFormat("2-digit", {
  numberingSystem: "latn",
  outputCalendar: "buddhist"
}): Array);
// $ExpectError
github flow-typed / flow-typed / definitions / npm / luxon_v0.2.x / flow_v0.104.x- / test_luxon.js View on Github external
// $ExpectError
(Info.eras("long", { foo: "bar" }): Array);

(Info.features().intl: boolean);
(Info.features().intlTokens: boolean);
(Info.features().timezones: boolean);

(Info.hasDST("America/Chicago"): boolean);
(Info.hasDST(new CustomZone()): boolean);

(Info.meridiems(): Array);
(Info.meridiems({ locale: "de-DE" }): Array);

(Info.months("long"): Array);
(Info.months("narrow", { locale: "de-DE" }): Array);
(Info.months("short", { numberingSystem: "arab" }): Array);
(Info.months("2-digit", {
  numberingSystem: "latn",
  outputCalendar: "buddhist"
}): Array);
// $ExpectError
(Info.months("long", { foo: "bar" }): Array);

(Info.monthsFormat("long"): Array);
(Info.monthsFormat("narrow", { locale: "de-DE" }): Array);
(Info.monthsFormat("short", { numberingSystem: "arab" }): Array);
(Info.monthsFormat("2-digit", {
  numberingSystem: "latn",
  outputCalendar: "buddhist"
}): Array);
// $ExpectError
(Info.monthsFormat("long", { foo: "bar" }): Array);
github flow-typed / flow-typed / definitions / npm / luxon_v1.x.x / flow_v0.104.x- / test_luxon.js View on Github external
(Info.eras("long"): Array);
(Info.eras("long", { locale: "de-DE" }): Array);
// $ExpectError
(Info.eras("long", { foo: "bar" }): Array);

(Info.features().intl: boolean);
(Info.features().intlTokens: boolean);
(Info.features().timezones: boolean);

(Info.hasDST("America/Chicago"): boolean);
(Info.hasDST(new CustomZone()): boolean);

(Info.meridiems(): Array);
(Info.meridiems({ locale: "de-DE" }): Array);

(Info.months("long"): Array);
(Info.months("narrow", { locale: "de-DE" }): Array);
(Info.months("short", { numberingSystem: "arab" }): Array);
(Info.months("2-digit", {
  numberingSystem: "latn",
  outputCalendar: "buddhist"
}): Array);
// $ExpectError
(Info.months("long", { foo: "bar" }): Array);

(Info.monthsFormat("long"): Array);
(Info.monthsFormat("narrow", { locale: "de-DE" }): Array);
(Info.monthsFormat("short", { numberingSystem: "arab" }): Array);
(Info.monthsFormat("2-digit", {
  numberingSystem: "latn",
  outputCalendar: "buddhist"
}): Array);
github DefinitelyTyped / DefinitelyTyped / types / luxon / luxon-tests.ts View on Github external
dt.locale; // $ExpectType string
DateTime.local().setLocale('fr').locale; // $ExpectType string
DateTime.local().reconfigure({ locale: 'fr' }).locale; // $ExpectType string

Settings.defaultLocale = 'fr';
DateTime.local().locale; // $ExpectType string

Settings.defaultLocale = DateTime.local().resolvedLocaleOpts().locale;

dt.setLocale('fr').toLocaleString(DateTime.DATE_FULL); // $ExpectType string
dt.toLocaleString({ locale: 'es', ...DateTime.DATE_FULL }); // $ExpectType string
dt.setLocale('fr').toFormat('MMMM dd, yyyy GG'); // $ExpectType string

DateTime.fromFormat('septembre 25, 2017 après Jésus-Christ', 'MMMM dd, yyyy GG', { locale: 'fr' });

Info.months('long', { locale: 'fr' }); // $ExpectType string[]
Info.weekdays('long', { locale: 'fr' }); // $ExpectType string[]
Info.eras('long', { locale: 'fr' }); // $ExpectType string[]

DateTime.local().reconfigure({ locale: 'it', numberingSystem: 'beng' });
Settings.defaultNumberingSystem = 'beng';

/* Time zones and offsets */
Info.features().zones; // $ExpectType boolean

const bogus = DateTime.local().setZone('America/Bogus');
bogus.isValid; // $ExpectType boolean
bogus.invalidReason; // $ExpectType string | null
bogus.invalidExplanation; // $ExpectType string | null

const local = DateTime.local(2017, 5, 15, 09, 10, 23);
local.zoneName; // $ExpectType string
github DefinitelyTyped / DefinitelyTyped / types / luxon / luxon-tests.ts View on Github external
i.toISO(); // $ExpectType string
i.toISODate(); // $ExpectType string
i.toISOTime(); // $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();
// $ExpectError
Info.months('2-digit', { outputCalendar: 'unknown' });
Info.weekdays('long');
// $ExpectError
Info.weekdays('2-digit');
Info.features().intl;
Info.features().intlTokens;
Info.features().zones;

/* Settings */
Settings.defaultLocale;
Settings.defaultLocale = 'en';
Settings.defaultZoneName = 'Europe/Paris';
Settings.throwOnInvalid = true;
Settings.now();
Settings.now = () => 0;
Settings.resetCaches();
github flow-typed / flow-typed / definitions / npm / luxon_v0.2.x / flow_v0.104.x- / test_luxon.js View on Github external
(Info.eras("long", { foo: "bar" }): Array);

(Info.features().intl: boolean);
(Info.features().intlTokens: boolean);
(Info.features().timezones: boolean);

(Info.hasDST("America/Chicago"): boolean);
(Info.hasDST(new CustomZone()): boolean);

(Info.meridiems(): Array);
(Info.meridiems({ locale: "de-DE" }): Array);

(Info.months("long"): Array);
(Info.months("narrow", { locale: "de-DE" }): Array);
(Info.months("short", { numberingSystem: "arab" }): Array);
(Info.months("2-digit", {
  numberingSystem: "latn",
  outputCalendar: "buddhist"
}): Array);
// $ExpectError
(Info.months("long", { foo: "bar" }): Array);

(Info.monthsFormat("long"): Array);
(Info.monthsFormat("narrow", { locale: "de-DE" }): Array);
(Info.monthsFormat("short", { numberingSystem: "arab" }): Array);
(Info.monthsFormat("2-digit", {
  numberingSystem: "latn",
  outputCalendar: "buddhist"
}): Array);
// $ExpectError
(Info.monthsFormat("long", { foo: "bar" }): Array);
github moment / luxon / test / info / info.js View on Github external
it('Info.months lists all the months', () => {
    expect(Info.months('long', 'en')).toEqual(
      ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
    );

    expect(Info.months('short', 'en')).toEqual(
      ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    );

    expect(Info.months('narrow', 'en')).toEqual(['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D']);

    expect(Info.months('numeric', 'en')).toEqual(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']);
  });
github mariomka / vue-datetime / src / util.js View on Github external
export function months () {
  return Info.months().map(month => capitalize(month))
}
github airbnb / lunar / packages / core / src / utils / getMonths.ts View on Github external
export default function getMonths(type?: UnitLength): Months {
  return Info.months(type, { locale: Core.locale() }) as Months;
}