[chore/frontend] use localized time string in status & poll info page #3821
+24
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR makes a workaround to display timestamps in the user's local timezone:
Precise timestamps (containing hours and minutes) now converted to user's local time using browser's toLocaleString(), while vague timestamps (e.g. "Dec, 2024") are unchanged
Currently, the
timestampPrecise
in the Template has been removed because there's no need to return the server's local time right now. However, the corresponding field intemplate.go
is still retained because I'm not sure if we might need it elsewhere.The time format that users actually use might differ from the originally defined format. For example, it might now display asIt seems that some browsers convert it to a format like12/31/2024, 11:11:11 PM
instead ofDec 31, 2024, 23:11
.2024-06-06T00:33:54.427Z
, so I'm explicitly specifying it to match thetimestampPrecise
format.Other parts of the settings panel already use
toLocalString
, so I didn't make any changes there.closes #3819
Checklist
Please put an x inside each checkbox to indicate that you've read and followed it:
[ ]
->[x]
If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).
go fmt ./...
andgolangci-lint run
.