Files
klz-cables.com/.pnpm-store/v10/files/0a/f1cc330030489d389d1df223f33bf484bd23bc73ae2affce18231f9f3feb89c9ea327fc00169eceac3c1c2eead1ab9d257a4fe8b10c3d742861cb576a9e527
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

54 lines
1.4 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GraphQLTimestamp = void 0;
const graphql_1 = require("graphql");
// Taken from https://gist.github.com/langpavel/b30f3d507a47713b0c6e89016e4e9eb7
function serializeDate(value) {
if (value instanceof Date) {
return value.getTime();
}
else if (typeof value === 'number') {
return Math.trunc(value);
}
else if (typeof value === 'string') {
return Date.parse(value);
}
return null;
}
function parseDate(value) {
if (value === null) {
return null;
}
try {
return new Date(value);
}
catch (err) {
return null;
}
}
function parseDateFromLiteral(ast) {
if (ast.kind === graphql_1.Kind.INT) {
const num = parseInt(ast.value, 10);
return new Date(num);
}
else if (ast.kind === graphql_1.Kind.STRING) {
return parseDate(ast.value);
}
return null;
}
exports.GraphQLTimestamp = new graphql_1.GraphQLScalarType({
name: 'Timestamp',
description: 'The javascript `Date` as integer. Type represents date and time ' +
'as number of milliseconds from start of UNIX epoch.',
serialize: serializeDate,
parseValue: parseDate,
parseLiteral: parseDateFromLiteral,
extensions: {
codegenScalarType: 'Date | string | number',
jsonSchema: {
type: 'string',
format: 'unix-time',
},
},
});