feat(api): add background refresh
This commit is contained in:
1 parent
4bc2df7bcc
commit
7e78b1f92d
7 files changed
+614
No files matched your search
@@ -0,0 +1,19 @@
|
||||
const BG_WINDOW_START_HOUR = 3;
|
||||
const BG_WINDOW_END_HOUR = 10;
|
||||
const KST_HOUR_FORMAT = new Intl.DateTimeFormat('en-US', {
|
||||
timeZone: 'Asia/Seoul',
|
||||
hour: '2-digit',
|
||||
hour12: false,
|
||||
});
|
||||
|
||||
export function isInKstBackgroundWindow(now: Date = new Date()): boolean {
|
||||
const hourString = KST_HOUR_FORMAT.format(now);
|
||||
const hour = Number.parseInt(hourString, 10);
|
||||
if (Number.isNaN(hour)) return false;
|
||||
|
||||
const normalizedHour = hour % 24;
|
||||
return (
|
||||
normalizedHour >= BG_WINDOW_START_HOUR &&
|
||||
normalizedHour < BG_WINDOW_END_HOUR
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user