Closed peymanebrahimi closed 7 years ago
Hi, What is the problem with the following code?
moment.locale('fa').format('jMMMM');
As you helped me with this nice and concise function of returning weekDayNames:
getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[] {
switch (style) {
case 'long':
return jmoment().localeData().weekdays().slice(0);
case 'short':
return jmoment().localeData().weekdaysShort().slice(0);
case 'narrow':
return jmoment().localeData().weekdaysMin().slice(0);
}
}
Is there any similar way to returning months name?
I need a consistent way, by calling localeData()
return jmoment().localeData().months().slice(0); // must return Persian names
Hi, you could use the following code
moment().localeData()._jMonths.slice(0);
moment().localeData()._jMonthsShort.slice(0);
moment().locale('fa').localeData()._jMonths.slice(0);
no such functions or properties in typescript. _jMonths is not available on localeData()
I will fix it in next version but for now you can cast and use it
(moment().localeData() as any)._jMonths.slice(0);
Thank you very much. nice of you as always
how can i change the names of the months to Afghanistan's month? is there any way to achieve this functionality?
You can find it in the moment documents https://www.tutorialspoint.com/momentjs/momentjs_customization_month_names.htm
Hi, This is not an issue. I have a question: What is the use cases of
Because of an issue in angular material 2 datepicker, if your library could set months name in the above code just to Persian names as moment's locale data, it may help on mentioned issue. Thanks again.