arshaw / xdate

A Modern JavaScript Date Library
http://arshaw.com/xdate/
GNU General Public License v2.0
681 stars 81 forks source link

No value for XDate.defaultLocale in XDate.locales #48

Closed wenyAlab closed 2 years ago

wenyAlab commented 2 years ago
  1. reactNative
  2. Android

The Android phone is in the English language environment. It is found that the value of XDate.defaultLocale is en-US, but there is no corresponding en-US in the XDate.locales object.

please check!!!

wenyAlab commented 2 years ago

One solution is: configure the corresponding local value:

LocaleConfig.locales.en_US = {
  monthNames: [
    'January',
    'February',
    'March',
    'April',
    'May',
    'June',
    'July',
    'August',
    'September',
    'October',
    'November',
    'December',
  ],
  monthNamesShort: [
    'Jan',
    'Feb',
    'Mar',
    'Apr',
    'May',
    'Jun',
    'Jul',
    'Aug',
    'Sep',
    'Oct',
    'Nov',
    'Dec',
  ],
  dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
};