scheduled_messages: Allow Today scheduling thru :54 past the hour.

This PR allows users to schedule Today messages from the modal opts
thru 8:54am (8:54) for sending at 9:00am, and thru 3:54pm (15:54) for
sending at 4:00pm. (That's including up to :59 seconds, of course, on
:54 after. So, XX:54:59.)

We also correct tests that were verifying incorrect logic of expecting
a 2PM cutoff, when we intended 4PM.

Fixes first part of #25451.
This commit is contained in:
Karl Stolley
2023-05-08 09:17:58 -05:00
committed by Tim Abbott
parent a318e7cbf4
commit 466422800a

View File

@@ -196,7 +196,6 @@ export function get_filtered_send_opts(date) {
const send_times = compute_send_times(date);
const day = date.getDay(); // Starts with 0 for Sunday.
const hours = date.getHours();
const send_later_today = {
today_nine_am: {
@@ -273,9 +272,14 @@ export function get_filtered_send_opts(date) {
let possible_send_later_today = {};
let possible_send_later_monday = {};
if (hours <= 8) {
const minutes_into_day = date.getHours() * 60 + date.getMinutes();
// Show Today send options based on time of day
if (minutes_into_day < 9 * 60 - MINIMUM_SCHEDULED_MESSAGE_DELAY_SECONDS / 60) {
// Allow Today at 9:00am only up to minimum scheduled message delay
possible_send_later_today = send_later_today;
} else if (hours <= 15) {
} else if (minutes_into_day < (12 + 2) * 60 - MINIMUM_SCHEDULED_MESSAGE_DELAY_SECONDS / 60) {
// Allow Today at 4:00pm only up to minimum scheduled message delay
possible_send_later_today.today_four_pm = send_later_today.today_four_pm;
} else {
possible_send_later_today = false;