@prismicio/client
Version:
The official JavaScript + TypeScript client library for Prismic
15 lines (14 loc) • 439 B
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const asDate = (dateOrTimestampField) => {
if (!dateOrTimestampField) {
return null;
}
if (dateOrTimestampField.length === 24) {
return new Date(dateOrTimestampField.replace(/(\+|-)(\d{2})(\d{2})$/, ".000$1$2:$3"));
} else {
return new Date(dateOrTimestampField);
}
};
exports.asDate = asDate;
//# sourceMappingURL=asDate.cjs.map