File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,4 +95,16 @@ describe("snoozeWakeDescription", () => {
9595 "18:00" ,
9696 ) ;
9797 } ) ;
98+
99+ it ( "uses the client locale for weekday and calendar-date labels" , ( ) => {
100+ const weekdayWake = localDate ( 2026 , 4 , 13 , 9 ) ;
101+ const dateWake = localDate ( 2026 , 4 , 20 , 9 ) ;
102+
103+ expect ( snoozeWakeDescription ( weekdayWake . toISOString ( ) , now , "locale" , "de-DE" ) ) . toContain (
104+ weekdayWake . toLocaleDateString ( "de-DE" , { weekday : "short" } ) ,
105+ ) ;
106+ expect ( snoozeWakeDescription ( dateWake . toISOString ( ) , now , "locale" , "de-DE" ) ) . toContain (
107+ dateWake . toLocaleDateString ( "de-DE" , { month : "short" , day : "numeric" } ) ,
108+ ) ;
109+ } ) ;
98110} ) ;
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ export function snoozeWakeDescription(
4242 snoozedUntil : string ,
4343 now : Date ,
4444 timestampFormat : TimestampFormat ,
45+ locale : string | undefined = getTimestampLocale ( ) ,
4546) : string {
4647 const wake = parseTimestampDate ( snoozedUntil ) ;
4748 if ( wake === null ) return "" ;
@@ -51,8 +52,8 @@ export function snoozeWakeDescription(
5152 const dayDelta = Math . floor ( ( wake . getTime ( ) - startOfToday . getTime ( ) ) / DAY_MS ) ;
5253 if ( dayDelta === 0 ) return time ;
5354 if ( dayDelta === 1 ) return `tomorrow ${ time } ` ;
54- const weekday = wake . toLocaleDateString ( undefined , { weekday : "short" } ) ;
55+ const weekday = wake . toLocaleDateString ( locale , { weekday : "short" } ) ;
5556 if ( dayDelta < 7 ) return `${ weekday } ${ time } ` ;
56- const date = wake . toLocaleDateString ( undefined , { month : "short" , day : "numeric" } ) ;
57+ const date = wake . toLocaleDateString ( locale , { month : "short" , day : "numeric" } ) ;
5758 return `${ date } , ${ time } ` ;
5859}
You can’t perform that action at this time.
0 commit comments