"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.secDuration = exports.formatDate = exports.fromNow = void 0;
var dayjs_1 = __importDefault(require("dayjs"));
var relativeTime_1 = __importDefault(require("dayjs/plugin/relativeTime"));
var duration_1 = __importDefault(require("dayjs/plugin/duration"));
dayjs_1.default.extend(relativeTime_1.default);
dayjs_1.default.extend(duration_1.default);
var fromNow = function (date, withoutSuffix) {
    if (withoutSuffix === void 0) { withoutSuffix = false; }
    if (!date || date === '0')
        return 'N/A';
    return (0, dayjs_1.default)(date).fromNow(withoutSuffix);
};
exports.fromNow = fromNow;
var formatDate = function (date, format) {
    if (format === void 0) { format = 'YYYY-MM-DD HH:MM:ss'; }
    if (!date || date === '0')
        return 'N/A';
    return (0, dayjs_1.default)(date).format(format);
};
exports.formatDate = formatDate;
var secDuration = function (seconds) {
    if (seconds == null || isNaN(seconds))
        return 'N/A';
    return dayjs_1.default.duration({ seconds: seconds }).humanize();
};
exports.secDuration = secDuration;
//# sourceMappingURL=date.js.map