Skip to content

Commit

Permalink
Fix formatter in expiration picker (#643)
Browse files Browse the repository at this point in the history
I don't think this will fix #641, but it gets rid of an unintentional
time zone conversion and makes the code clearer.
  • Loading branch information
mtlynch authored Jan 4, 2025
1 parent 8168834 commit 064fd9f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion handlers/templates/custom-elements/expiration-picker.html
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 064fd9f

Please sign in to comment.