payload-plugin-scheduler
Version:
Scheduled posts plugin for PayloadCMS
17 lines • 761 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatDateTime = void 0;
var date_fns_1 = require("date-fns");
function formatDateTime(inputDateTime, lowerCase) {
if (lowerCase === void 0) { lowerCase = true; }
var firstChar = lowerCase ? 't' : 'T';
if ((0, date_fns_1.isToday)(inputDateTime)) {
return "".concat(firstChar, "oday, ").concat((0, date_fns_1.format)(inputDateTime, 'h:mm a'));
}
if ((0, date_fns_1.isTomorrow)(inputDateTime)) {
return "".concat(firstChar, "omorrow, ").concat((0, date_fns_1.format)(inputDateTime, 'h:mm a'));
}
return (0, date_fns_1.format)(inputDateTime, 'M/d/yy h:mm a');
}
exports.formatDateTime = formatDateTime;
//# sourceMappingURL=util.js.map