Skip to content

Commit

Permalink
fix: LocaleData plugin returns all months and weekdays data when pas …
Browse files Browse the repository at this point in the history
…no argument (#645)
  • Loading branch information
vigosan authored and iamkun committed Aug 6, 2019
1 parent a385d5c commit 95e70b4
Show file tree
Hide file tree
Showing 31 changed files with 63 additions and 12 deletions.
6 changes: 5 additions & 1 deletion src/locale/ar.js
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
2 changes: 2 additions & 0 deletions src/locale/bg.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ const locale = {
name: 'bg',
weekdays: 'Неделя_Понеделник_Вторник_Сряда_Четвъртък_Петък_Събота'.split('_'),
weekdaysShort: 'нед_пон_вто_сря_чет_пет_съб'.split('_'),
weekdaysMin: 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
months: 'Януари_Февруари_Март_Април_Май_Юни_Юли_Август_Септември_Октомври_Ноември_Декември'.split('_'),
monthsShort: 'Янр_Фев_Мар_Апр_Май_Юни_Юли_Авг_Сеп_Окт_Ное_Дек'.split('_'),
weekStart: 1,
ordinal: n => `${n}.`,
formats: {
Expand Down
2 changes: 2 additions & 0 deletions src/locale/ca.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions src/locale/cs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
1 change: 1 addition & 0 deletions src/locale/de-at.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}.`,
Expand Down
1 change: 1 addition & 0 deletions src/locale/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}.`,
Expand Down
1 change: 1 addition & 0 deletions src/locale/el.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const locale = {
name: 'el',
weekdays: 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split('_'),
weekdaysShort: 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'),
weekdaysMin: 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'),
months: 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split('_'),
monthsShort: 'Ιαν_Φεβ_Μαρ_Απρ_Μαι_Ιουν_Ιουλ_Αυγ_Σεπτ_Οκτ_Νοε_Δεκ'.split('_'),
ordinal: n => n,
Expand Down
5 changes: 4 additions & 1 deletion src/locale/en.js
Original file line number Diff line number Diff line change
@@ -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('_')
}
2 changes: 2 additions & 0 deletions src/locale/fa.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions src/locale/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/locale/fy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('_'),
Expand Down Expand Up @@ -36,4 +37,3 @@ const locale = {
dayjs.locale(locale, null, true)

export default locale

2 changes: 2 additions & 0 deletions src/locale/hr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/locale/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -40,4 +41,3 @@ const locale = {
dayjs.locale(locale, null, true)

export default locale

2 changes: 2 additions & 0 deletions src/locale/ka.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ const locale = {
name: 'ka',
weekdays: 'კვირა_ორშაბათი_სამშაბათი_გარემო_ხუთშაბათი_პარასკევი_შაბათს'.split('_'),

This comment has been minimized.

Copy link
@corrot

corrot Oct 2, 2019

this has to be changed to:
weekdays: 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split('_')

This comment has been minimized.

Copy link
@iamkun

iamkun Oct 3, 2019

Owner

@corrot Thanks. Can you review this commit, please?
f8ca3d4

weekdaysShort: 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'),
weekdaysMin: 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'),
months: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split('_'),
monthsShort: 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'),
weekStart: 1,
formats: {
LT: 'h:mm A',
Expand Down
2 changes: 2 additions & 0 deletions src/locale/ko.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions src/locale/lt.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 2 additions & 0 deletions src/locale/ms.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions src/locale/ne.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ const locale = {
name: 'ne',
weekdays: 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split('_'),
weekdaysShort: 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'),
weekdaysMin: 'आ._सो._मं._बु._बि._शु._श.'.split('_'),
months: 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मे_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split('_'),
monthsShort: 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split('_'),
relativeTime: {
future: '%s पछि',
past: '%s अघि',
Expand Down
2 changes: 1 addition & 1 deletion src/locale/nl-be.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('_'),
Expand Down Expand Up @@ -36,4 +37,3 @@ const locale = {
dayjs.locale(locale, null, true)

export default locale

1 change: 1 addition & 0 deletions src/locale/nl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}.`,
Expand Down
1 change: 1 addition & 0 deletions src/locale/oc-lnc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/locale/pl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -36,4 +37,3 @@ const locale = {
dayjs.locale(locale, null, true)

export default locale

1 change: 1 addition & 0 deletions src/locale/pt-br.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/locale/pt.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}º`,
Expand Down Expand Up @@ -36,4 +37,3 @@ const locale = {
dayjs.locale(locale, null, true)

export default locale

2 changes: 2 additions & 0 deletions src/locale/ro.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions src/locale/sk.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions src/locale/sr-cyrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ const locale = {
name: 'sr-cyrl',
weekdays: 'Недеља_Понедељак_Уторак_Среда_Четвртак_Петак_Субота'.split('_'),
weekdaysShort: 'Нед._Пон._Уто._Сре._Чет._Пет._Суб.'.split('_'),
weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'),
months: 'Јануар_Фебруар_Март_Април_Мај_Јун_Јул_Август_Септембар_Октобар_Новембар_Децембар'.split('_'),
monthsShort: 'Јан._Феб._Мар._Апр._Мај_Јун_Јул_Авг._Сеп._Окт._Нов._Дец.'.split('_'),
weekStart: 1,
relativeTime: {
future: 'за %s',
Expand Down
2 changes: 2 additions & 0 deletions src/locale/sr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions src/locale/tr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
13 changes: 8 additions & 5 deletions src/plugin/localeData/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -20,4 +24,3 @@ export default (o, c, dayjs) => { // locale needed later
}
}
}

4 changes: 4 additions & 0 deletions test/plugin/localeData.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 95e70b4

Please sign in to comment.