studiocms
Version:
Astro Native CMS for AstroDB. Built from the ground up by the Astro community.
33 lines (32 loc) • 653 B
JavaScript
const allowedIdentifiers = [
"studiocms/markdown",
"studiocms/html",
"studiocms/mdx",
"studiocms/markdoc",
"studiocms/wysiwyg"
];
function withinLast30Days(date) {
const now = /* @__PURE__ */ new Date();
const thirtyDaysAgo = new Date(now.setDate(now.getDate() - 30));
return date > thirtyDaysAgo;
}
function sortByDate(a, b, desc) {
if (!a && !b) {
return 0;
}
if (!a) {
a = /* @__PURE__ */ new Date(0);
}
if (!b) {
b = /* @__PURE__ */ new Date(0);
}
if (desc) {
return a.getTime() - b.getTime();
}
return b.getTime() - a.getTime();
}
export {
allowedIdentifiers,
sortByDate,
withinLast30Days
};