Rocky_Mountain_Vending/.pnpm-store/v10/files/3d/b62fd5cee573b703f2ff1cf117d27b306c57f5c711ecae9aedb37adda8ad34d83d8e17ceecc1aeb9baeec0551f2d5484d20292933e36707253e3edb9855fe9
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

75 lines
No EOL
2.3 KiB
Text

"use strict";
exports.tzScan = tzScan;
var _index = require("../tzOffset/index.cjs");
/**
* Time interval.
*/
/**
* Time zone change record.
*/
/**
* The function scans the time zone for changes in the given interval.
*
* @param timeZone - Time zone name (IANA or UTC offset)
* @param interval - Time interval to scan for changes
*
* @returns Array of time zone changes
*/
function tzScan(timeZone, interval) {
const changes = [];
const monthDate = new Date(interval.start);
monthDate.setUTCSeconds(0, 0);
const endDate = new Date(interval.end);
endDate.setUTCSeconds(0, 0);
const endMonthTime = +endDate;
let lastOffset = (0, _index.tzOffset)(timeZone, monthDate);
while (+monthDate < endMonthTime) {
// Month forward
monthDate.setUTCMonth(monthDate.getUTCMonth() + 1);
// Find the month where the offset changes
const offset = (0, _index.tzOffset)(timeZone, monthDate);
if (offset != lastOffset) {
// Rewind a month back to find the day where the offset changes
const dayDate = new Date(monthDate);
dayDate.setUTCMonth(dayDate.getUTCMonth() - 1);
const endDayTime = +monthDate;
lastOffset = (0, _index.tzOffset)(timeZone, dayDate);
while (+dayDate < endDayTime) {
// Day forward
dayDate.setUTCDate(dayDate.getUTCDate() + 1);
// Find the day where the offset changes
const offset = (0, _index.tzOffset)(timeZone, dayDate);
if (offset != lastOffset) {
// Rewind a day back to find the time where the offset changes
const hourDate = new Date(dayDate);
hourDate.setUTCDate(hourDate.getUTCDate() - 1);
const endHourTime = +dayDate;
lastOffset = (0, _index.tzOffset)(timeZone, hourDate);
while (+hourDate < endHourTime) {
// Hour forward
hourDate.setUTCHours(hourDate.getUTCHours() + 1);
// Find the hour where the offset changes
const hourOffset = (0, _index.tzOffset)(timeZone, hourDate);
if (hourOffset !== lastOffset) {
changes.push({
date: new Date(hourDate),
change: hourOffset - lastOffset,
offset: hourOffset
});
}
lastOffset = hourOffset;
}
}
lastOffset = offset;
}
}
lastOffset = offset;
}
return changes;
}