gravitational / teleport

The easiest, and most secure way to access and protect all of your infrastructure.
https://goteleport.com
GNU Affero General Public License v3.0
17.37k stars 1.74k forks source link

WebUX: Unify time display #39326

Open kimlisa opened 6 months ago

kimlisa commented 6 months ago

We have various ways to show dates in our web UI

audit:

image

devices:

image

access list:

image

other areas:

our date helpers along with configured formats

@ravicious had nice suggestion here about using Intl.DateTimeFormat so that users are used to the time format from there location

ravicious commented 6 months ago

The only small problem with Intl.DateTimeFormat is that it takes locale as the argument and might include non-English words as part of the output. That is fine for short dates, but if we try to use it for spelling out "March 14th, 2024", then it's going to say "March" in whatever language the user has set.

Looking at the existing date helpers, it's probably better to just use them consistently throughout the code.

I just don't understand why the file is named loc.ts, I'd have never guessed that it contains date helpers. Is it short for localization? Maybe it was created with that in mind, but we've never got to localizing Teleport I suppose.

ravicious commented 6 months ago

@rudream It looks like the date helpers in loc.ts also have some built-in utilities to make sure that the output of them in tests is consistent no matter the environment. I remember you had a problem with some dates being formatted as 2019-08-30 vs 8/30/2019 depending on whether the tests were ran in VSCode vs iTerm (slack thread).

kimlisa commented 6 months ago

@rudream It looks like the date helpers in loc.ts also have some built-in utilities to make sure that the output of them in tests is consistent no matter the environment. I remember you had a problem with some dates being formatted as 2019-08-30 vs 8/30/2019 depending on whether the tests were ran in VSCode vs iTerm (slack thread).

i just looked up the issue about date and this is issue, we are using toLocaleDateString there

kimlisa commented 6 months ago

recording notes from meeting here: