UNPKG

rsshub

Version:
13 lines (11 loc) 452 B
import { strict } from "node:assert"; //#region lib/utils/timezone.ts const millisInAnHour = 3600 * 1e3; const serverTimezone = -(/* @__PURE__ */ new Date()).getTimezoneOffset() / 60; function timezone(date, timezone$1 = serverTimezone) { if (typeof date === "string") date = new Date(date); strict.ok(date instanceof Date); return new Date(date.getTime() - millisInAnHour * (timezone$1 - serverTimezone)); } //#endregion export { timezone as t };