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.
23 lines
502 B
23 lines
502 B
'use strict';
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.formatDate = formatDate;
|
|
function formatDate(value, format) {
|
|
if (!value) {
|
|
return '';
|
|
}
|
|
if (Array.isArray(format)) {
|
|
format = format[0];
|
|
}
|
|
if (typeof format === 'function') {
|
|
var result = format(value);
|
|
if (typeof result === 'string') {
|
|
return result;
|
|
} else {
|
|
throw new Error('The function of format does not return a string');
|
|
}
|
|
}
|
|
return value.format(format);
|
|
}
|