"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.periodFormat = void 0;
const moment_1 = __importDefault(require("moment"));
const periodFormat = (start, end, format = 'YYYY-MM-DD, HH:mm:ss') => {
    let from = start === 'unknown' ? '' : (0, moment_1.default)(start).format(format);
    let to = end === 'unknown' ? '' : (0, moment_1.default)(end).format(format);
    if (!to) {
        // only format one time
        from = from === 'Invalid date' ? 'n/a' : from;
        return `${from}`;
    }
    if (from === 'Invalid date' && to === 'Invalid date') {
        return 'n/a';
    }
    from = from === 'Invalid date' ? 'n/a' : from;
    to = to === 'Invalid date' ? 'n/a' : to;
    return `${from} ~ ${to}`;
};
exports.periodFormat = periodFormat;
exports.default = { periodFormat: exports.periodFormat };
