mirror of
https://github.com/nextcloud/server.git
synced 2026-05-25 02:34:12 -04:00
enh: set later today to 6pm
Signed-off-by: Christopher Ng <chrng8@gmail.com>
(cherry picked from commit 9d43583b47)
This commit is contained in:
parent
0c0ed382f8
commit
87f9700ff5
2 changed files with 20 additions and 13 deletions
|
|
@ -191,8 +191,11 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
options(): ReminderOption[] {
|
||||
const computeOption = (option: ReminderOption) => {
|
||||
const computeOption = (option: ReminderOption): null | ReminderOption => {
|
||||
const dateTime = getDateTime(option.dateTimePreset)
|
||||
if (!dateTime) {
|
||||
return null
|
||||
}
|
||||
return {
|
||||
...option,
|
||||
ariaLabel: `${option.ariaLabel} – ${getVerboseDateString(dateTime)}`,
|
||||
|
|
@ -201,12 +204,15 @@ export default Vue.extend({
|
|||
}
|
||||
}
|
||||
|
||||
return [
|
||||
const options = [
|
||||
laterToday,
|
||||
tomorrow,
|
||||
thisWeekend,
|
||||
nextWeek,
|
||||
].map(computeOption)
|
||||
]
|
||||
return options
|
||||
.map(computeOption)
|
||||
.filter(Boolean) as ReminderOption[]
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -30,14 +30,17 @@ export enum DateTimePreset {
|
|||
NextWeek,
|
||||
}
|
||||
|
||||
export const getDateTime = (dateTime: DateTimePreset): Date => {
|
||||
const matchPreset: Record<DateTimePreset, () => Date> = {
|
||||
export const getDateTime = (dateTime: DateTimePreset): null | Date => {
|
||||
const matchPreset: Record<DateTimePreset, () => null | Date> = {
|
||||
[DateTimePreset.LaterToday]: () => {
|
||||
const hour = moment().get('hour')
|
||||
const later = moment()
|
||||
const now = moment()
|
||||
const evening = moment()
|
||||
.startOf('day')
|
||||
.add(hour + 3, 'hour')
|
||||
return later.toDate()
|
||||
.add(18, 'hour')
|
||||
if (now.isSameOrAfter(evening)) {
|
||||
return null
|
||||
}
|
||||
return evening.toDate()
|
||||
},
|
||||
|
||||
[DateTimePreset.Tomorrow]: () => {
|
||||
|
|
@ -45,8 +48,7 @@ export const getDateTime = (dateTime: DateTimePreset): Date => {
|
|||
.add(1, 'day')
|
||||
.startOf('day')
|
||||
.add(8, 'hour')
|
||||
.toDate()
|
||||
return day
|
||||
return day.toDate()
|
||||
},
|
||||
|
||||
[DateTimePreset.ThisWeekend]: () => {
|
||||
|
|
@ -80,8 +82,7 @@ export const getDateTime = (dateTime: DateTimePreset): Date => {
|
|||
.startOf('isoWeek')
|
||||
.add(1, 'week')
|
||||
.add(8, 'hour')
|
||||
.toDate()
|
||||
return day
|
||||
return day.toDate()
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue