@techsio/storefront-data
Version:
Medusa-first storefront data layer built on TanStack Query.
13 lines (12 loc) • 379 B
JavaScript
const toComparableTimestamp = (value)=>{
if (value instanceof Date) {
const timestamp = value.getTime();
return Number.isNaN(timestamp) ? -1 / 0 : timestamp;
}
if ("string" == typeof value) {
const parsed = Date.parse(value);
return Number.isNaN(parsed) ? -1 / 0 : parsed;
}
return -1 / 0;
};
export { toComparableTimestamp };