@fe6/water-pro
Version:
An enterprise-class UI design language and Vue-based implementation
32 lines (26 loc) • 703 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.formatDate = formatDate;
exports.generateShowHourMinuteSecond = generateShowHourMinuteSecond;
function formatDate(value, format) {
if (!value) {
return '';
}
if (Array.isArray(format)) {
format = format[0];
}
if (typeof format === 'function') {
return format(value);
}
return value.format(format);
}
function generateShowHourMinuteSecond(format) {
// Ref: http://momentjs.com/docs/#/parsing/string-format/
return {
showHour: format.includes('H') || format.includes('h') || format.includes('k'),
showMinute: format.includes('m'),
showSecond: format.includes('s')
};
}