Skip to content

Commit

Permalink
enh: rename to saturday sunday
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <chrng8@gmail.com>
  • Loading branch information
Pytal committed Aug 9, 2023
1 parent 07c0f7e commit c2dfc42
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions apps/files_reminders/src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,28 @@ export const getDateTime = (dateTime: DateTimePreset): Date => {

[DateTimePreset.ThisWeekend]: () => {
const today = moment()
const weekendFirstDay = moment()
const saturday = moment()
.startOf('isoWeek')
.add(5, 'day')
.add(9, 'hour')
const weekendSecondDay = moment()
const sunday = moment()
.startOf('isoWeek')
.add(6, 'day')
.add(9, 'hour')
if (today.isSame(weekendFirstDay, 'date')) {
return weekendFirstDay
if (today.isSame(saturday, 'date')) {
return saturday
.add(1, 'day')
.toDate()
}
if (today.isSame(weekendSecondDay, 'date')) {
return weekendSecondDay
if (today.isSame(sunday, 'date')) {
return sunday
.add(1, 'week')
.startOf('isoWeek')
.add(5, 'day')
.add(9, 'hour')
.toDate()
}
return weekendFirstDay.toDate()
return saturday.toDate()
},

[DateTimePreset.NextWeek]: () => {
Expand Down

0 comments on commit c2dfc42

Please sign in to comment.