Fix birthday time offset and date locale #66
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/date"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The user's configred birthday is stored as UTC time, so use that for display as well.
This means the birthday won't be shown as a day behind or ahead depending on the user's browser timezone.
Also use the locale configured in the user's client settings in Misskey for date formatting.
Strictly speaking the birthday is stored without time zone information. To my knowledge of ISO 8601 this means local time zone should be assumed. (Which is of course not what Javascript does with
new Date()
...)Anyway, I guess synchronizing what JavaScript thinks the time is with what it is being formatted as should fix the problem for
absolute
. It might cause problems if resolutions of hours or below are being used, but that is not the case here so I don't think it should be a problem.@ -21,3 +24,4 @@
const _time = typeof props.time === 'string' ? new Date(props.time) : props.time;
const absolute = ((): string => {
const timeZone = props.utc ? 'UTC' : Intl.DateTimeFormat().resolvedOptions().timeZone;
I'd maybe have written this in a way that the second parameter to
toLocale...String
is just an empty object if UTC is not given. But this should work just as well.7940747c7d
to1cb5856f7c