Files
klz-cables.com/.pnpm-store/v10/files/92/c2af693cb5e316c6a5129afde4610e296f18002f32a8c0b6e531b239ab19726035874b95d18be5effff49e1ad7fff28aa291eaf4c86306a88df4d93c14b54e
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

58 lines
1.1 KiB
Plaintext

import { constructFrom } from "../../constructFrom.js";
import { transpose } from "../../transpose.js";
const TIMEZONE_UNIT_PRIORITY = 10;
export class Setter {
subPriority = 0;
validate(_utcDate, _options) {
return true;
}
}
export class ValueSetter extends Setter {
constructor(
value,
validateValue,
setValue,
priority,
subPriority,
) {
super();
this.value = value;
this.validateValue = validateValue;
this.setValue = setValue;
this.priority = priority;
if (subPriority) {
this.subPriority = subPriority;
}
}
validate(date, options) {
return this.validateValue(date, this.value, options);
}
set(date, flags, options) {
return this.setValue(date, flags, this.value, options);
}
}
export class DateTimezoneSetter extends Setter {
priority = TIMEZONE_UNIT_PRIORITY;
subPriority = -1;
constructor(context, reference) {
super();
this.context = context || ((date) => constructFrom(reference, date));
}
set(date, flags) {
if (flags.timestampIsSet) return date;
return constructFrom(date, transpose(date, this.context));
}
}