2015-08-25 21:53:03 +00:00
|
|
|
define( [
|
|
|
|
"jquery",
|
|
|
|
"globalize",
|
|
|
|
"lib/helper",
|
|
|
|
"globalize/date"
|
|
|
|
], function( $, Globalize, helper ) {
|
|
|
|
|
|
|
|
return $.extend( helper, {
|
|
|
|
getAttributes: function( locale ) {
|
|
|
|
var globalize = new Globalize( locale ),
|
2015-10-08 13:06:55 +00:00
|
|
|
weekdayShortFormatter = globalize.dateFormatter( { raw: "EEEEEE" } ),
|
2015-11-25 21:22:31 +00:00
|
|
|
weekdayNarrowFormatter = globalize.dateFormatter( { raw: "EEEEE" } ),
|
2015-11-18 18:43:35 +00:00
|
|
|
firstDayRaw = globalize.dateFormatter( { raw: "c" } )( new Date( 1970, 0, 3 ) );
|
2015-08-25 21:53:03 +00:00
|
|
|
|
|
|
|
return {
|
2015-11-18 18:43:35 +00:00
|
|
|
firstDay: ( 7 - globalize.parseNumber( firstDayRaw ) ),
|
2015-08-25 21:53:03 +00:00
|
|
|
formatWeekdayShort: function( date ) {
|
|
|
|
|
|
|
|
// Return the short weekday if its length is < 3. Otherwise, its narrow form.
|
|
|
|
var shortWeekday = weekdayShortFormatter( date );
|
|
|
|
|
|
|
|
return shortWeekday.length > 3 ? weekdayNarrowFormatter( date ) : shortWeekday;
|
|
|
|
},
|
2015-10-08 13:06:55 +00:00
|
|
|
formatWeekdayFull: globalize.dateFormatter( { raw: "EEEE" } ),
|
|
|
|
formatMonth: globalize.dateFormatter( { raw: "MMMM" } ),
|
|
|
|
formatWeekOfYear: globalize.dateFormatter( { raw: "w" } )
|
2015-08-25 21:53:03 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
|
|
|
} );
|