File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,12 @@ describe("resolveSnoozePresets", () => {
2727 expect ( twoHours ) . toMatchObject ( { label : "In 2 hours" } ) ;
2828 expect ( new Date ( twoHours ! . snoozedUntil ) . getHours ( ) ) . toBe ( 12 ) ;
2929 expect ( twoHours ! . whenLabel ) . not . toBe ( "" ) ;
30+ // Same-day wakes show only the time; a favorite on another day names it.
31+ const weekday = ( preset : { snoozedUntil : string } ) =>
32+ new Date ( preset . snoozedUntil ) . toLocaleDateString ( undefined , { weekday : "short" } ) ;
33+ const twoDays = presets . find ( ( preset ) => preset . id === "favorite:2-days" ) ;
34+ expect ( twoHours ! . whenLabel ) . not . toContain ( weekday ( twoHours ! ) ) ;
35+ expect ( twoDays ! . whenLabel . startsWith ( weekday ( twoDays ! ) ) ) . toBe ( true ) ;
3036 } ) ;
3137
3238 it ( "keeps wake times ascending when evening falls before three hours" , ( ) => {
Original file line number Diff line number Diff line change @@ -30,8 +30,11 @@ export function resolveSnoozePresets(
3030 const time = timeOfDayLabel ( wake , timestampFormat ) ;
3131 return {
3232 ...preset ,
33+ // A wake on another day names its weekday, so a saved duration such
34+ // as "26 hours" does not read as earlier than "Tomorrow".
3335 whenLabel :
34- preset . id === "next-week"
36+ preset . id === "next-week" ||
37+ ( preset . id . startsWith ( "favorite:" ) && wake . toDateString ( ) !== now . toDateString ( ) )
3538 ? `${ wake . toLocaleDateString ( undefined , { weekday : "short" } ) } ${ time } `
3639 : time ,
3740 } ;
You can’t perform that action at this time.
0 commit comments