scheduled_messages: Disallow dates in the past in the UI.

The server will probably accept them and just send the message
immediately, which seems OK, but we probably want to discourage
scheduling a message to be sent in the past, since that's unlikely to
be intentional and would make it hard to undo.
This commit is contained in:
Tim Abbott 2023-04-28 18:55:16 -07:00
parent cef1e3363c
commit 56c5c8902b
1 changed files with 3 additions and 1 deletions

View File

@ -911,10 +911,12 @@ export function initialize() {
}
});
$send_later_modal.on("click", ".send_later_custom", (e) => {
const current_time = new Date();
flatpickr.show_flatpickr(
$(".send_later_custom")[0],
update_scheduled_date_from_modal,
new Date(),
new Date(current_time.getTime() + 60 * 60 * 1000),
{minDate: new Date(current_time.getTime() + 5 * 60 * 1000)},
);
e.preventDefault();
e.stopPropagation();