2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 19:39:07 +00:00

fix date picker not showing right timezone

This commit is contained in:
Ankit Singhaniya 2021-09-04 23:09:55 +05:30 committed by 18alantom
parent eae8057571
commit 09594101ef

View File

@ -199,6 +199,13 @@ export default {
}, },
toValue(date) { toValue(date) {
// toISOString is buggy and reduces the day by one
// this is because it considers the UTC timestmap
// in order to curcumvent that we need to use luxon/moment
// but that refactor could take some time, so fixing the time differnece
// ass suggested in this answer.
// https://stackoverflow.com/a/16084846/3541205
date.setHours(0, -date.getTimezoneOffset(), 0, 0);
return date.toISOString().slice(0, 10); return date.toISOString().slice(0, 10);
}, },