From 064fd9f3d8aa345349df2b6693aa25df08646e4f Mon Sep 17 00:00:00 2001 From: Michael Lynch Date: Fri, 3 Jan 2025 20:19:21 -0500 Subject: [PATCH] Fix formatter in expiration picker (#643) I don't think this will fix #641, but it gets rid of an unintentional time zone conversion and makes the code clearer. --- handlers/templates/custom-elements/expiration-picker.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/handlers/templates/custom-elements/expiration-picker.html b/handlers/templates/custom-elements/expiration-picker.html index 05063f64..d4e5722a 100644 --- a/handlers/templates/custom-elements/expiration-picker.html +++ b/handlers/templates/custom-elements/expiration-picker.html @@ -33,8 +33,12 @@ ); } + // Format the date in YYYY-MM-DD format without converting to UTC time. function formatDate(date) { - return date.toISOString().split("T")[0]; + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, "0"); + const day = String(date.getDate()).padStart(2, "0"); + return `${year}-${month}-${day}`; } function tomorrow() {