From 61e23f134149bcc8606e2730ce9f396357c1aacc Mon Sep 17 00:00:00 2001 From: Vicent Gozalbes Date: Mon, 29 Jul 2019 10:52:04 +0200 Subject: [PATCH] Return all months and weekdays when no argument `months`, `monthsShort`, `weekdaysMin` and `weekdaysShort` functions return all months and weeksdays when no `dayjs` instance passed as argument. More info here https://momentjs.com/docs/#/i18n/locale-data/ --- src/locale/ar.js | 6 +++++- src/locale/bg.js | 2 ++ src/locale/ca.js | 2 ++ src/locale/cs.js | 2 ++ src/locale/de-at.js | 1 + src/locale/de.js | 1 + src/locale/el.js | 1 + src/locale/en.js | 5 ++++- src/locale/fa.js | 2 ++ src/locale/fr.js | 1 + src/locale/fy.js | 2 +- src/locale/hr.js | 2 ++ src/locale/ja.js | 2 +- src/locale/ka.js | 2 ++ src/locale/ko.js | 2 ++ src/locale/lt.js | 2 ++ src/locale/ms.js | 2 ++ src/locale/ne.js | 2 ++ src/locale/nl-be.js | 2 +- src/locale/nl.js | 1 + src/locale/oc-lnc.js | 1 + src/locale/pl.js | 2 +- src/locale/pt-br.js | 1 + src/locale/pt.js | 2 +- src/locale/ro.js | 2 ++ src/locale/sk.js | 2 ++ src/locale/sr-cyrl.js | 2 ++ src/locale/sr.js | 2 ++ src/locale/tr.js | 2 ++ src/plugin/localeData/index.js | 13 ++++++++----- test/plugin/localeData.test.js | 4 ++++ 31 files changed, 63 insertions(+), 12 deletions(-) diff --git a/src/locale/ar.js b/src/locale/ar.js index 136ddca8c..2acb0652a 100644 --- a/src/locale/ar.js +++ b/src/locale/ar.js @@ -1,10 +1,14 @@ import dayjs from 'dayjs' +const months = 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_') + const locale = { name: 'ar', weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'), weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'), - months: 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'), + weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'), + months, + monthsShort: months, weekStart: 6, relativeTime: { future: 'بعد %s', diff --git a/src/locale/bg.js b/src/locale/bg.js index f73ead9f1..96438dd90 100644 --- a/src/locale/bg.js +++ b/src/locale/bg.js @@ -4,7 +4,9 @@ const locale = { name: 'bg', weekdays: 'Неделя_Понеделник_Вторник_Сряда_Четвъртък_Петък_Събота'.split('_'), weekdaysShort: 'нед_пон_вто_сря_чет_пет_съб'.split('_'), + weekdaysMin: 'нд_пн_вт_ср_чт_пт_сб'.split('_'), months: 'Януари_Февруари_Март_Април_Май_Юни_Юли_Август_Септември_Октомври_Ноември_Декември'.split('_'), + monthsShort: 'Янр_Фев_Мар_Апр_Май_Юни_Юли_Авг_Сеп_Окт_Ное_Дек'.split('_'), weekStart: 1, ordinal: n => `${n}.`, formats: { diff --git a/src/locale/ca.js b/src/locale/ca.js index 9229386be..c6469085b 100644 --- a/src/locale/ca.js +++ b/src/locale/ca.js @@ -4,7 +4,9 @@ const locale = { name: 'ca', weekdays: 'Diumenge_Dilluns_Dimarts_Dimecres_Dijous_Divendres_Dissabte'.split('_'), weekdaysShort: 'Dg._Dl._Dt._Dc._Dj._Dv._Ds.'.split('_'), + weekdaysMin: 'Dg_Dl_Dt_Dc_Dj_Dv_Ds'.split('_'), months: 'Gener_Febrer_Març_Abril_Maig_Juny_Juliol_Agost_Setembre_Octubre_Novembre_Desembre'.split('_'), + monthsShort: 'Gen._Febr._Març_Abr._Maig_Juny_Jul._Ag._Set._Oct._Nov._Des.'.split('_'), weekStart: 1, formats: { LT: 'H:mm', diff --git a/src/locale/cs.js b/src/locale/cs.js index 02b182e99..3910b8dcf 100644 --- a/src/locale/cs.js +++ b/src/locale/cs.js @@ -4,7 +4,9 @@ const locale = { name: 'cs', weekdays: 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'), weekdaysShort: 'ne_po_út_st_čt_pá_so'.split('_'), + weekdaysMin: 'ne_po_út_st_čt_pá_so'.split('_'), months: 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'), + monthsShort: 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_'), weekStart: 1, ordinal: n => `${n}.`, formats: { diff --git a/src/locale/de-at.js b/src/locale/de-at.js index 108e5be6d..52a192ec5 100644 --- a/src/locale/de-at.js +++ b/src/locale/de-at.js @@ -4,6 +4,7 @@ const locale = { name: 'de-at', weekdays: 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), weekdaysShort: 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), + weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), months: 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), monthsShort: 'Jän._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), ordinal: n => `${n}.`, diff --git a/src/locale/de.js b/src/locale/de.js index 1bc8c5ec6..13013d0cc 100644 --- a/src/locale/de.js +++ b/src/locale/de.js @@ -4,6 +4,7 @@ const locale = { name: 'de', weekdays: 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'), weekdaysShort: 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), + weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), months: 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'), monthsShort: 'Jan_Feb_März_Apr_Mai_Juni_Juli_Aug_Sept_Okt_Nov_Dez'.split('_'), ordinal: n => `${n}.`, diff --git a/src/locale/el.js b/src/locale/el.js index 8b633190d..f6aa7a70e 100644 --- a/src/locale/el.js +++ b/src/locale/el.js @@ -4,6 +4,7 @@ const locale = { name: 'el', weekdays: 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split('_'), weekdaysShort: 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'), + weekdaysMin: 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'), months: 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split('_'), monthsShort: 'Ιαν_Φεβ_Μαρ_Απρ_Μαι_Ιουν_Ιουλ_Αυγ_Σεπτ_Οκτ_Νοε_Δεκ'.split('_'), ordinal: n => n, diff --git a/src/locale/en.js b/src/locale/en.js index c4cd9b856..76cc04fbd 100644 --- a/src/locale/en.js +++ b/src/locale/en.js @@ -1,5 +1,8 @@ export default { name: 'en', weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_') + weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), + monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_') } diff --git a/src/locale/fa.js b/src/locale/fa.js index 74a1c5382..9ba95a6c3 100644 --- a/src/locale/fa.js +++ b/src/locale/fa.js @@ -4,7 +4,9 @@ const locale = { name: 'fa', weekdays: 'یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه'.split('_'), weekdaysShort: 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'), + weekdaysMin: 'ی_د_س_چ_پ_ج_ش'.split('_'), months: 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), + monthsShort: 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'), ordinal: n => n, formats: { LT: 'HH:mm', diff --git a/src/locale/fr.js b/src/locale/fr.js index e667ca6c0..20b7cfe3c 100644 --- a/src/locale/fr.js +++ b/src/locale/fr.js @@ -4,6 +4,7 @@ const locale = { name: 'fr', weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'), weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'), + weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'), months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'), monthsShort: 'janv_févr_mars_avril_mai_juin_juil_août_sept_oct_nov_déc'.split('_'), weekStart: 1, diff --git a/src/locale/fy.js b/src/locale/fy.js index 371612146..2bff3e14a 100644 --- a/src/locale/fy.js +++ b/src/locale/fy.js @@ -4,6 +4,7 @@ const locale = { name: 'fy', weekdays: 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split('_'), months: 'jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber'.split('_'), + monthsShort: 'jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.'.split('_'), weekStart: 1, weekdaysShort: 'si._mo._ti._wo._to._fr._so.'.split('_'), weekdaysMin: 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'), @@ -36,4 +37,3 @@ const locale = { dayjs.locale(locale, null, true) export default locale - diff --git a/src/locale/hr.js b/src/locale/hr.js index 8e1bd1148..22e962756 100644 --- a/src/locale/hr.js +++ b/src/locale/hr.js @@ -4,7 +4,9 @@ const locale = { name: 'hr', weekdays: 'Nedjelja_Ponedjeljak_Utorak_Srijeda_Četvrtak_Petak_Subota'.split('_'), weekdaysShort: 'Ned._Pon._Uto._Sri._Čet._Pet._Sub.'.split('_'), + weekdaysMin: 'Ne_Po_Ut_Sr_Če_Pe_Su'.split('_'), months: 'Siječanj_Veljača_Ožujak_Travanj_Svibanj_Lipanj_Srpanj_Kolovoz_Rujan_Listopad_Studeni_Prosinac'.split('_'), + monthsShort: 'Sij._Velj._Ožu._Tra._Svi._Lip._Srp._Kol._Ruj._Lis._Stu._Pro.'.split('_'), weekStart: 1, formats: { LT: 'H:mm', diff --git a/src/locale/ja.js b/src/locale/ja.js index 2d2d2dbe3..dd206b198 100644 --- a/src/locale/ja.js +++ b/src/locale/ja.js @@ -6,6 +6,7 @@ const locale = { weekdaysShort: '日_月_火_水_木_金_土'.split('_'), weekdaysMin: '日_月_火_水_木_金_土'.split('_'), months: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), + monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'), ordinal: n => `${n}日`, formats: { LT: 'HH:mm', @@ -40,4 +41,3 @@ const locale = { dayjs.locale(locale, null, true) export default locale - diff --git a/src/locale/ka.js b/src/locale/ka.js index e143b5fa8..38bfe64bd 100644 --- a/src/locale/ka.js +++ b/src/locale/ka.js @@ -4,7 +4,9 @@ const locale = { name: 'ka', weekdays: 'კვირა_ორშაბათი_სამშაბათი_გარემო_ხუთშაბათი_პარასკევი_შაბათს'.split('_'), weekdaysShort: 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'), + weekdaysMin: 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'), months: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split('_'), + monthsShort: 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'), weekStart: 1, formats: { LT: 'h:mm A', diff --git a/src/locale/ko.js b/src/locale/ko.js index 451420cff..cbb3c81c7 100644 --- a/src/locale/ko.js +++ b/src/locale/ko.js @@ -4,7 +4,9 @@ const locale = { name: 'ko', weekdays: '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'), weekdaysShort: '일_월_화_수_목_금_토'.split('_'), + weekdaysMin: '일_월_화_수_목_금_토'.split('_'), months: '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), + monthsShort: '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), ordinal: n => n, formats: { LT: 'A h:mm', diff --git a/src/locale/lt.js b/src/locale/lt.js index 565757373..319f63db0 100644 --- a/src/locale/lt.js +++ b/src/locale/lt.js @@ -4,7 +4,9 @@ const locale = { name: 'lt', weekdays: 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split('_'), weekdaysShort: 'sek_pir_ant_tre_ket_pen_šeš'.split('_'), + weekdaysMin: 's_p_a_t_k_pn_š'.split('_'), months: 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split('_'), + monthsShort: 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'), ordinal: n => `${n}.`, weekStart: 1, relativeTime: { diff --git a/src/locale/ms.js b/src/locale/ms.js index 9054ef369..0cd50d9b4 100644 --- a/src/locale/ms.js +++ b/src/locale/ms.js @@ -4,7 +4,9 @@ const locale = { name: 'ms', weekdays: 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'), weekdaysShort: 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'), + weekdaysMin: 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'), months: 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'), + monthsShort: 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'), weekStart: 1, formats: { LT: 'HH.mm', diff --git a/src/locale/ne.js b/src/locale/ne.js index 76e357760..75b508782 100644 --- a/src/locale/ne.js +++ b/src/locale/ne.js @@ -4,7 +4,9 @@ const locale = { name: 'ne', weekdays: 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split('_'), weekdaysShort: 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'), + weekdaysMin: 'आ._सो._मं._बु._बि._शु._श.'.split('_'), months: 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मे_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split('_'), + monthsShort: 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split('_'), relativeTime: { future: '%s पछि', past: '%s अघि', diff --git a/src/locale/nl-be.js b/src/locale/nl-be.js index c45816daa..e86dd4f15 100644 --- a/src/locale/nl-be.js +++ b/src/locale/nl-be.js @@ -4,6 +4,7 @@ const locale = { name: 'nl-be', weekdays: 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'), months: 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'), + monthsShort: 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'), weekStart: 1, weekdaysShort: 'zo._ma._di._wo._do._vr._za.'.split('_'), weekdaysMin: 'zo_ma_di_wo_do_vr_za'.split('_'), @@ -36,4 +37,3 @@ const locale = { dayjs.locale(locale, null, true) export default locale - diff --git a/src/locale/nl.js b/src/locale/nl.js index 094293bb9..9466c53ba 100644 --- a/src/locale/nl.js +++ b/src/locale/nl.js @@ -4,6 +4,7 @@ const locale = { name: 'nl', weekdays: 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'), weekdaysShort: 'zo._ma._di._wo._do._vr._za.'.split('_'), + weekdaysMin: 'zo_ma_di_wo_do_vr_za'.split('_'), months: 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'), monthsShort: 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'), ordinal: n => `${n}.`, diff --git a/src/locale/oc-lnc.js b/src/locale/oc-lnc.js index ce8a5dc0e..f4ef9aab7 100644 --- a/src/locale/oc-lnc.js +++ b/src/locale/oc-lnc.js @@ -4,6 +4,7 @@ const locale = { name: 'oc-lnc', weekdays: 'dimenge_diluns_dimars_dimècres_dijòus_divendres_dissabte'.split('_'), weekdaysShort: 'Dg_Dl_Dm_Dc_Dj_Dv_Ds'.split('_'), + weekdaysMin: 'dg_dl_dm_dc_dj_dv_ds'.split('_'), months: 'genièr_febrièr_març_abrial_mai_junh_julhet_agost_setembre_octòbre_novembre_decembre'.split('_'), monthsShort: 'gen_feb_març_abr_mai_junh_julh_ago_set_oct_nov_dec'.split('_'), weekStart: 1, diff --git a/src/locale/pl.js b/src/locale/pl.js index 49b9fc1b9..3defaf484 100644 --- a/src/locale/pl.js +++ b/src/locale/pl.js @@ -6,6 +6,7 @@ const locale = { weekdaysShort: 'Ndz_Pon_Wt_Śr_Czw_Pt_Sob'.split('_'), weekdaysMin: 'Nd_Pn_Wt_Śr_Cz_Pt_So'.split('_'), months: 'Styczeń_Luty_Marzec_Kwiecień_Maj_Czerwiec_Lipiec_Sierpień_Wrzesień_Październik_Listopad_Grudzień'.split('_'), + monthsShort: 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'), ordinal: n => `${n}.`, weekStart: 1, relativeTime: { @@ -36,4 +37,3 @@ const locale = { dayjs.locale(locale, null, true) export default locale - diff --git a/src/locale/pt-br.js b/src/locale/pt-br.js index 66f15851d..3a0c1b033 100644 --- a/src/locale/pt-br.js +++ b/src/locale/pt-br.js @@ -7,6 +7,7 @@ const locale = { weekdaysMin: 'Do_2ª_3ª_4ª_5ª_6ª_Sá'.split('_'), weekStart: 1, months: 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), + monthsShort: 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), ordinal: n => `${n}º`, formats: { LT: 'HH:mm', diff --git a/src/locale/pt.js b/src/locale/pt.js index f9e70f10b..2f5216c5d 100644 --- a/src/locale/pt.js +++ b/src/locale/pt.js @@ -4,6 +4,7 @@ const locale = { name: 'pt', weekdays: 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split('_'), weekdaysShort: 'Dom_Seg_Ter_Qua_Qui_Sex_Sab'.split('_'), + weekdaysMin: 'Do_2ª_3ª_4ª_5ª_6ª_Sa'.split('_'), months: 'Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro'.split('_'), monthsShort: 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'), ordinal: n => `${n}º`, @@ -36,4 +37,3 @@ const locale = { dayjs.locale(locale, null, true) export default locale - diff --git a/src/locale/ro.js b/src/locale/ro.js index c6fe28f1b..99a975d9d 100644 --- a/src/locale/ro.js +++ b/src/locale/ro.js @@ -4,7 +4,9 @@ const locale = { name: 'ro', weekdays: 'Duminică_Luni_Marți_Miercuri_Joi_Vineri_Sâmbătă'.split('_'), weekdaysShort: 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'), + weekdaysMin: 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'), months: 'Ianuarie_Februarie_Martie_Aprilie_Mai_Iunie_Iulie_August_Septembrie_Octombrie_Noiembrie_Decembrie'.split('_'), + monthsShort: 'Ian._Febr._Mart._Apr._Mai_Iun._Iul._Aug._Sept._Oct._Nov._Dec.'.split('_'), weekStart: 1, formats: { LT: 'H:mm', diff --git a/src/locale/sk.js b/src/locale/sk.js index b17642cab..ce01f431e 100644 --- a/src/locale/sk.js +++ b/src/locale/sk.js @@ -4,7 +4,9 @@ const locale = { name: 'sk', weekdays: 'Nedeľa_Pondelok_Utorok_Streda_Štvrtok_Piatok_Sobota'.split('_'), weekdaysShort: 'Ne_Po_Ut_St_Št_Pi_So'.split('_'), + weekdaysMin: 'ne_po_ut_st_št_pi_so'.split('_'), months: 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'), + monthsShort: 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'), weekStart: 1, relativeTime: { future: 'o %s', diff --git a/src/locale/sr-cyrl.js b/src/locale/sr-cyrl.js index aaedc368d..c1950cca7 100644 --- a/src/locale/sr-cyrl.js +++ b/src/locale/sr-cyrl.js @@ -4,7 +4,9 @@ const locale = { name: 'sr-cyrl', weekdays: 'Недеља_Понедељак_Уторак_Среда_Четвртак_Петак_Субота'.split('_'), weekdaysShort: 'Нед._Пон._Уто._Сре._Чет._Пет._Суб.'.split('_'), + weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'), months: 'Јануар_Фебруар_Март_Април_Мај_Јун_Јул_Август_Септембар_Октобар_Новембар_Децембар'.split('_'), + monthsShort: 'Јан._Феб._Мар._Апр._Мај_Јун_Јул_Авг._Сеп._Окт._Нов._Дец.'.split('_'), weekStart: 1, relativeTime: { future: 'за %s', diff --git a/src/locale/sr.js b/src/locale/sr.js index 84bdedd8f..6578290a3 100644 --- a/src/locale/sr.js +++ b/src/locale/sr.js @@ -4,7 +4,9 @@ const locale = { name: 'sr', weekdays: 'Nedelja_Ponedeljak_Utorak_Sreda_Četvrtak_Petak_Subota'.split('_'), weekdaysShort: 'Ned._Pon._Uto._Sre._Čet._Pet._Sub.'.split('_'), + weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'), months: 'Januar_Februar_Mart_April_Maj_Jun_Jul_Avgust_Septembar_Oktobar_Novembar_Decembar'.split('_'), + monthsShort: 'Jan._Feb._Mar._Apr._Maj_Jun_Jul_Avg._Sep._Okt._Nov._Dec.'.split('_'), weekStart: 1, relativeTime: { future: 'za %s', diff --git a/src/locale/tr.js b/src/locale/tr.js index 7f7c48eb3..281983283 100644 --- a/src/locale/tr.js +++ b/src/locale/tr.js @@ -4,7 +4,9 @@ const locale = { name: 'tr', weekdays: 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split('_'), weekdaysShort: 'Paz_Pts_Sal_Çar_Per_Cum_Cts'.split('_'), + weekdaysMin: 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.split('_'), months: 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split('_'), + monthsShort: 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'), weekStart: 1, formats: { LT: 'HH:mm', diff --git a/src/plugin/localeData/index.js b/src/plugin/localeData/index.js index dae8f7b65..c49a1117e 100644 --- a/src/plugin/localeData/index.js +++ b/src/plugin/localeData/index.js @@ -2,11 +2,15 @@ export default (o, c, dayjs) => { // locale needed later const proto = c.prototype const localeData = function () { return { - months: instance => instance.format('MMMM'), - monthsShort: instance => instance.format('MMM'), + months: instance => + (instance ? instance.format('MMMM') : this.$locale().months), + monthsShort: instance => + (instance ? instance.format('MMM') : this.$locale().monthsShort), firstDayOfWeek: () => this.$locale().weekStart || 0, - weekdaysMin: instance => instance.format('dd'), - weekdaysShort: instance => instance.format('ddd') + weekdaysMin: instance => + (instance ? instance.format('dd') : this.$locale().weekdaysMin), + weekdaysShort: instance => + (instance ? instance.format('ddd') : this.$locale().weekdaysShort) } } proto.localeData = function () { @@ -20,4 +24,3 @@ export default (o, c, dayjs) => { // locale needed later } } } - diff --git a/test/plugin/localeData.test.js b/test/plugin/localeData.test.js index 7b42a69bf..151713b67 100644 --- a/test/plugin/localeData.test.js +++ b/test/plugin/localeData.test.js @@ -21,9 +21,13 @@ it('instance localeData', () => { const momentLocaleData = moment().localeData() expect(dayjsLocaleData.firstDayOfWeek()).toBe(momentLocaleData.firstDayOfWeek()) expect(dayjsLocaleData.months(d)).toBe(momentLocaleData.months(m)) + expect(dayjsLocaleData.months()).toEqual(momentLocaleData.months()) expect(dayjsLocaleData.monthsShort(d)).toBe(momentLocaleData.monthsShort(m)) + expect(dayjsLocaleData.monthsShort()).toEqual(momentLocaleData.monthsShort()) expect(dayjsLocaleData.weekdaysMin(d)).toBe(momentLocaleData.weekdaysMin(m)) + expect(dayjsLocaleData.weekdaysMin()).toEqual(momentLocaleData.weekdaysMin()) expect(dayjsLocaleData.weekdaysShort(d)).toBe(momentLocaleData.weekdaysShort(m)) + expect(dayjsLocaleData.weekdaysShort()).toEqual(momentLocaleData.weekdaysShort()) }) it('global localeData', () => {