You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
876 B
36 lines
876 B
import { formattingTokens } from '../format/format';
|
|
|
|
export var defaultLongDateFormat = {
|
|
LTS: 'h:mm:ss A',
|
|
LT: 'h:mm A',
|
|
L: 'MM/DD/YYYY',
|
|
LL: 'MMMM D, YYYY',
|
|
LLL: 'MMMM D, YYYY h:mm A',
|
|
LLLL: 'dddd, MMMM D, YYYY h:mm A',
|
|
};
|
|
|
|
export function longDateFormat(key) {
|
|
var format = this._longDateFormat[key],
|
|
formatUpper = this._longDateFormat[key.toUpperCase()];
|
|
|
|
if (format || !formatUpper) {
|
|
return format;
|
|
}
|
|
|
|
this._longDateFormat[key] = formatUpper
|
|
.match(formattingTokens)
|
|
.map(function (tok) {
|
|
if (
|
|
tok === 'MMMM' ||
|
|
tok === 'MM' ||
|
|
tok === 'DD' ||
|
|
tok === 'dddd'
|
|
) {
|
|
return tok.slice(1);
|
|
}
|
|
return tok;
|
|
})
|
|
.join('');
|
|
|
|
return this._longDateFormat[key];
|
|
}
|
|
|