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.
 
 
 
 

17 lines
396 B

export 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);
}