Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to preview user-local-time in 12h format #3597

Closed
Daksh777 opened this issue Sep 26, 2020 · 6 comments · Fixed by #3627
Closed

Ability to preview user-local-time in 12h format #3597

Daksh777 opened this issue Sep 26, 2020 · 6 comments · Fixed by #3627
Labels
enhancement help wanted small Issues that new contributors can pick up

Comments

@Daksh777
Copy link

I do not see any option in the extensions settings to change the user-local-time format to 12h, it would be great if it were possible to change it.
image

@cheap-glitch
Copy link
Member

I think this breaks the two following requirements:

  • It makes sense as a default for everyone: I don't know about Asia, but here in Europe where I live, most people use the 24h time format (with the exception of England ofc, and maybe others?)
  • It doesn't require options: seems that it would be a setting of user-local-time

@Daksh777
Copy link
Author

  • It makes sense as a default for everyone: I don't know about Asia, but here in Europe where I live, most people use the 24h time format (with the exception of England ofc, and maybe others?)

I agree that it makes sense as a default format for everyone, but it would be great if it could be customized/changed to 12h format. Also this is a feature request and you can always close the issue if you don't want to implement it, it's totally on you.

  • It doesn't require options: seems that it would be a setting of user-local-time

Yes, that's what I meant.

@fregante
Copy link
Member

fregante commented Sep 26, 2020

Times are displayed as 24h across the site by GitHub as well, and also are the standard for flight travel (i.e. many are familiar with it even in 12h countries), so it’ll just have to stay (because we don’t offer per-feature options)

If/when web pages will be able to read the system settings, maybe that can change.

@cheap-glitch
Copy link
Member

If/when web pages will be able to read the system settings, maybe that can change.

Wait, can't we do something like

timeFormat = /[AP]M$/.test((new Date()).toLocaleString()) ? 12 : 24;

?

@fregante
Copy link
Member

fregante commented Sep 26, 2020

That follows the locale, not the system’s settings (which may vary), but it looks like GitHub uses the local format as well.

Accepted.

I think the solution is to just pass undefined here:

const timeFormatter = new Intl.DateTimeFormat(undefined, {
	hour: 'numeric',
	minute: 'numeric'
});

@Daksh777
Copy link
Author

Daksh777 commented Oct 8, 2020

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted small Issues that new contributors can pick up
Development

Successfully merging a pull request may close this issue.

3 participants