mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 08:16:09 +08:00
fix(date-utils): Update semantics of 'Tonight'
- If it is past 8pm, it will snooze until midnight
This commit is contained in:
parent
265eb2d4e9
commit
3e67d0b451
|
@ -49,7 +49,8 @@ chronoFuture.refiners.push(EnforceFutureDate);
|
|||
|
||||
const Hours = {
|
||||
Morning: 9,
|
||||
Evening: 19,
|
||||
Evening: 20,
|
||||
Midnight: 24,
|
||||
}
|
||||
|
||||
const Days = {
|
||||
|
@ -69,6 +70,10 @@ function evening(momentDate, eveningHour = Hours.Evening) {
|
|||
return oclock(momentDate.hour(eveningHour))
|
||||
}
|
||||
|
||||
function midnight(momentDate, midnightHour = Hours.Midnight) {
|
||||
return oclock(momentDate.hour(midnightHour))
|
||||
}
|
||||
|
||||
|
||||
const DateUtils = {
|
||||
|
||||
|
@ -100,7 +105,7 @@ const DateUtils = {
|
|||
|
||||
tonight(now = moment()) {
|
||||
if (now.hour() >= Hours.Evening) {
|
||||
return DateUtils.tomorrowEvening();
|
||||
return midnight(now);
|
||||
}
|
||||
return evening(now)
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue