@@ -20,7 +20,7 @@ export interface FreebuffModelOption {
2020/** Server-facing fallback copy for APIs and provider errors that can't know
2121 * the caller's local timezone. The CLI should render
2222 * `getFreebuffDeploymentAvailabilityLabel()` instead. */
23- export const FREEBUFF_DEPLOYMENT_HOURS_LABEL = '9am ET-5pm PT'
23+ export const FREEBUFF_DEPLOYMENT_HOURS_LABEL = '9am ET-5pm PT every day '
2424export const FREEBUFF_GLM_MODEL_ID = 'z-ai/glm-5.1'
2525export const FREEBUFF_MINIMAX_MODEL_ID = 'minimax/minimax-m2.7'
2626const FREEBUFF_EASTERN_TIMEZONE = 'America/New_York'
@@ -30,7 +30,6 @@ interface ZonedDateParts {
3030 year : number
3131 month : number
3232 day : number
33- weekday : string
3433 hour : number
3534 minute : number
3635}
@@ -96,7 +95,6 @@ function getZonedParts(date: Date, timeZone: string): ZonedDateParts {
9695 year : 'numeric' ,
9796 month : '2-digit' ,
9897 day : '2-digit' ,
99- weekday : 'short' ,
10098 hour : '2-digit' ,
10199 minute : '2-digit' ,
102100 hourCycle : 'h23' ,
@@ -112,7 +110,6 @@ function getZonedParts(date: Date, timeZone: string): ZonedDateParts {
112110 year,
113111 month,
114112 day,
115- weekday : value ( 'weekday' ) ?? '' ,
116113 hour,
117114 minute,
118115 }
@@ -165,34 +162,11 @@ function getUtcForZonedTime(
165162 return guess
166163}
167164
168- function isWeekend (
169- parts : Pick < ZonedDateParts , 'year' | 'month' | 'day' > ,
170- ) : boolean {
171- const weekday = getWeekdayIndex ( parts )
172- return weekday === 0 || weekday === 6
173- }
174-
175- function getWeekdayIndex (
176- parts : Pick < ZonedDateParts , 'year' | 'month' | 'day' > ,
177- ) : number {
178- return new Date ( Date . UTC ( parts . year , parts . month - 1 , parts . day ) ) . getUTCDay ( )
179- }
180-
181165function getNextFreebuffDeploymentStart ( now : Date ) : Date {
182166 const easternNow = getZonedParts ( now , FREEBUFF_EASTERN_TIMEZONE )
183- const weekday = getWeekdayIndex ( easternNow )
184167 const isBeforeTodayOpen = easternNow . hour < 9
185168
186- const offset =
187- weekday === 6
188- ? 2
189- : weekday === 0
190- ? 1
191- : isBeforeTodayOpen
192- ? 0
193- : weekday === 5
194- ? 3
195- : 1
169+ const offset = isBeforeTodayOpen ? 0 : 1
196170
197171 return getUtcForZonedTime (
198172 addDaysToYmd ( easternNow . year , easternNow . month , easternNow . day , offset ) ,
@@ -241,17 +215,16 @@ export function getFreebuffDeploymentAvailabilityLabel(
241215) : string {
242216 if ( isFreebuffDeploymentHours ( now ) ) {
243217 const closesAt = getCurrentFreebuffDeploymentEnd ( now )
244- return `until ${ formatLocalTime ( closesAt , now , options ) } local `
218+ return `until ${ formatLocalTime ( closesAt , now , options ) } `
245219 }
246220
247221 const opensAt = getNextFreebuffDeploymentStart ( now )
248- return `opens ${ formatLocalTime ( opensAt , now , options ) } local `
222+ return `opens ${ formatLocalTime ( opensAt , now , options ) } `
249223}
250224
251225export function isFreebuffDeploymentHours ( now : Date = new Date ( ) ) : boolean {
252226 const eastern = getZonedParts ( now , FREEBUFF_EASTERN_TIMEZONE )
253227 const pacific = getZonedParts ( now , FREEBUFF_PACIFIC_TIMEZONE )
254- if ( eastern . weekday === 'Sat' || eastern . weekday === 'Sun' ) return false
255228 return (
256229 eastern . hour * 60 + eastern . minute >= 9 * 60 &&
257230 pacific . hour * 60 + pacific . minute < 17 * 60
0 commit comments