export var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
export function localeWeekdays (m, format) {
- if (typeof m === 'undefined') {
+ if (!m) {
return this._weekdays;
}
return isArray(this._weekdays) ? this._weekdays[m.day()] :
export var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
export function localeWeekdaysShort (m) {
- if (typeof m === 'undefined') {
- return this._weekdaysShort;
- }
- return this._weekdaysShort[m.day()];
+ return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
}
export var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
export function localeWeekdaysMin (m) {
- if (typeof m === 'undefined') {
- return this._weekdaysMin;
- }
- return this._weekdaysMin[m.day()];
+ return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
}
function handleStrictParse(weekdayName, format, strict) {
import indexOf from '../utils/index-of';
import { createUTC } from '../create/utc';
import getParsingFlags from '../create/parsing-flags';
+import isUndefined from '../utils/is-undefined';
export function daysInMonth(year, month) {
return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/;
export var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
export function localeMonths (m, format) {
- if (typeof m === 'undefined') {
+ if (!m) {
return this._months;
}
return isArray(this._months) ? this._months[m.month()] :
export var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
export function localeMonthsShort (m, format) {
- if (typeof m === 'undefined') {
+ if (!m) {
return this._monthsShort;
}
return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
assert.deepEqual(moment.monthsShort('-MMM-', 2), 'threesy');
assert.deepEqual(moment.monthsShort(2), 'three');
});
+
+test('with locale data', function (assert) {
+ var months = 'one_two_three_four_five_six_seven_eight_nine_ten_eleven_twelve'.split('_'),
+ monthsShort = 'on_tw_th_fo_fi_si_se_ei_ni_te_el_tw'.split('_'),
+ weekdays = 'one_two_three_four_five_six_seven'.split('_'),
+ weekdaysShort = 'on_tw_th_fo_fi_si_se'.split('_'),
+ weekdaysMin = '1_2_3_4_5_6_7'.split('_'),
+ weekdaysLocale = 'four_five_six_seven_one_two_three'.split('_'),
+ weekdaysShortLocale = 'fo_fi_si_se_on_tw_th'.split('_'),
+ weekdaysMinLocale = '4_5_6_7_1_2_3'.split('_'),
+ week = {
+ dow : 3,
+ doy : 6
+ };
+
+ var customLocale = moment.localeData('numerologists');
+
+ assert.deepEqual(customLocale.months(), months);
+ assert.deepEqual(customLocale.monthsShort(), monthsShort);
+ assert.deepEqual(customLocale.weekdays(), weekdays);
+ assert.deepEqual(customLocale.weekdaysShort(), weekdaysShort);
+ assert.deepEqual(customLocale.weekdaysMin(), weekdaysMin);
+});