3
0
Fork 0

fix: fix timezone offset bug for datepicker

only applies when user manually keys in a date..

hopefully this is a sufficient fix..but it does not actually make
sense to me yet, so we'll see..
This commit is contained in:
Lance Edgar 2025-04-16 21:14:04 -05:00
parent 3274553557
commit 749aca560a

View file

@ -339,9 +339,15 @@
}
// just need to convert to simple ISO date format here, seems
// like there should be a more obvious way to do that?
var year = date.getFullYear()
var month = date.getMonth() + 1
var day = date.getDate()
// nb. also, not sure if/what i am missing here but
// when user keys in a date, the component must assume
// UTC (?) but the value passed to this method may be
// offset in such a way that a *different date* is
// implied! hence we must convert back to UTC when
// isolating each part.. *shrug*
var year = date.getUTCFullYear()
var month = date.getUTCMonth() + 1
var day = date.getUTCDate()
month = month < 10 ? '0' + month : month
day = day < 10 ? '0' + day : day
return year + '-' + month + '-' + day