How to use the luxon.Info.weekdays 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_v0.2.x / flow_v0.104.x- / test_luxon.js View on Github external
// $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);

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

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

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

(Info.weekdaysFormat("long"): Array);
(Info.weekdaysFormat("narrow", { locale: "de-DE" }): Array);
(Info.weekdaysFormat("short", { numberingSystem: "arab" }): Array);
(Info.weekdaysFormat("long", {
  numberingSystem: "latn",
  outputCalendar: "buddhist"
}): Array);
// $ExpectError
github flow-typed / flow-typed / definitions / npm / luxon_v1.x.x / flow_v0.104.x- / test_luxon.js View on Github external
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);

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

(Info.weekdaysFormat("long"): Array);
(Info.weekdaysFormat("narrow", { locale: "de-DE" }): Array);
(Info.weekdaysFormat("short", { numberingSystem: "arab" }): Array);
(Info.weekdaysFormat("long", {
  numberingSystem: "latn",
  outputCalendar: "buddhist"
}): Array);
github DefinitelyTyped / DefinitelyTyped / types / luxon / luxon-tests.ts View on Github external
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
local.toString(); // $ExpectType string
github flow-typed / flow-typed / definitions / npm / luxon_v0.2.x / flow_v0.104.x- / test_luxon.js View on Github external
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);

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

(Info.weekdaysFormat("long"): Array);
(Info.weekdaysFormat("narrow", { locale: "de-DE" }): Array);
(Info.weekdaysFormat("short", { numberingSystem: "arab" }): Array);
(Info.weekdaysFormat("long", {
  numberingSystem: "latn",
  outputCalendar: "buddhist"
}): Array);
github flow-typed / flow-typed / definitions / npm / luxon_v1.x.x / flow_v0.104.x- / test_luxon.js View on Github external
}): 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);

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

(Info.weekdaysFormat("long"): Array);
(Info.weekdaysFormat("narrow", { locale: "de-DE" }): Array);
(Info.weekdaysFormat("short", { numberingSystem: "arab" }): Array);
(Info.weekdaysFormat("long", {
  numberingSystem: "latn",
  outputCalendar: "buddhist"
}): Array);
// $ExpectError
github moment / luxon / test / info / info.js View on Github external
it('Info.weekdays lists all the weekdays', () => {
    expect(Info.weekdays('long', 'en')).toEqual(
      ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
    );

    expect(Info.weekdays('short', 'en')).toEqual(['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']);

    expect(Info.weekdays('narrow', 'en')).toEqual(['S', 'M', 'T', 'W', 'T', 'F', 'S']);

    expect(Info.weekdays('long', 'ru')).toEqual(
      ['воскресенье', 'понедельник', 'вторник', 'среда', 'четверг', 'пятница', 'суббота']
    );
  });
github moment / luxon / test / info / info.js View on Github external
it('Info.weekdays lists all the weekdays', () => {
    expect(Info.weekdays('long', 'en')).toEqual(
      ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
    );

    expect(Info.weekdays('short', 'en')).toEqual(['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']);

    expect(Info.weekdays('narrow', 'en')).toEqual(['S', 'M', 'T', 'W', 'T', 'F', 'S']);

    expect(Info.weekdays('long', 'ru')).toEqual(
      ['воскресенье', 'понедельник', 'вторник', 'среда', 'четверг', 'пятница', 'суббота']
    );
  });
github airbnb / lunar / packages / core / src / utils / getWeekdays.ts View on Github external
export default function getWeekdays(
  type?: StringUnitLength,
  sundayFirst: boolean = false,
): Weekdays {
  const days = [...Info.weekdays(type, { locale: Core.locale() })];

  if (sundayFirst) {
    const sunday = days.pop();
    days.unshift(sunday!);
  }

  return days as Weekdays;
}
github mariomka / vue-datetime / src / util.js View on Github external
export function weekdays (weekStart) {
  if (--weekStart < 0) {
    weekStart = 6
  }

  let weekDays = Info.weekdays('short').map(weekday => capitalize(weekday))

  weekDays = weekDays.concat(weekDays.splice(0, weekStart))

  return weekDays
}