fix(date-utils): Update semantics of 'Tonight'

- If it is past 8pm, it will snooze until midnight
This commit is contained in:
Juan Tejada 2016-02-25 11:55:22 -08:00
parent 265eb2d4e9
commit 3e67d0b451

View file

@ -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)
},