gitHistoryVSCode icon indicating copy to clipboard operation
gitHistoryVSCode copied to clipboard

setting for date format

Open SailorMax opened this issue 7 years ago • 17 comments

Can you add setting to modify date format? Or use system format? In our region we use 24H time format.

SailorMax avatar Mar 15 '17 14:03 SailorMax

Currently we use the language of vscode to format dates. vscode.env.language So if vscode is in french for example we will display 24h. It might be inconsistent to have a system date format if vscode is set to another language.

Happy to look at this though.

What is your language please eg en-GB

mikes-gh avatar Mar 15 '17 14:03 mikes-gh

F1 / Configure Language / {"locale":"en"} Where I can find vscode.env.language?

SailorMax avatar Mar 15 '17 14:03 SailorMax

AFAIK its only programmatic. locale en would show 12h I believe. Remember its node and browser date handling and things aren't quite as . For example vscode doesn't support all locales. What is your system locale?

mikes-gh avatar Mar 15 '17 14:03 mikes-gh

UI: English (US) Region format: English (US) modified for time format Location: Latvia System Locale: en-us;English (United States)

SailorMax avatar Mar 15 '17 14:03 SailorMax

Because we use toLocaleDateString toLocaleDateString returns 12h for en-US and for example 24h for French I think its an ISO thing.

Your system date settings wouldn't be honoured. I haven't looked into it but I would suspect node (what vscode is based on) wont have access to that setting in a cross platform way.

I think the only way would be

  1. Use a vscode lang that defaults to 24hr
  2. Have a setting for 24h in gitHistory that overides the default toLocaleDateString.

mikes-gh avatar Mar 15 '17 15:03 mikes-gh

VSCode support only "en" and "en-GB". Both "work" as 12H.

GitLens has setting "dateFormat". Hope author of GitHistory will add it also.

SailorMax avatar Mar 15 '17 15:03 SailorMax

Yes I think as GitLens does you have to configure it in the extension as node can't read the 24hr setting from the OS. I'll keep this open as a feature request for a configuration value.

mikes-gh avatar Mar 15 '17 15:03 mikes-gh

Yes, would really be nice to see real ISO data format yyyy-mm-dd since the American format is useless. Some countries use dd/mm/yyyy and US is mm/dd/yyyy - so impossible to tell unless you have dates after the 12th. You should simply be able to set the format or you should use ISO, which is the only format that makes sense :-)

hoegge avatar Dec 11 '19 19:12 hoegge

The language setting did not seem to properly work the way it was expected. Since it previously uses node package os-locale to identify the operating system language which may not match vscode display langauge

In PR #433 (or even more specific in commit 427bf71) this should be fixed. This does not resolve the previous request of customizing the date format through configuration for instance. So I will keep it open

ole1986 avatar Feb 04 '20 11:02 ole1986

for those who want English with but don't want the ridiculous US date format, you can change to en-GB by following the instructions here https://code.visualstudio.com/docs/getstarted/locales It should prompt you to install the en-GB package if it is not already installed

Dunkhan avatar Nov 12 '20 16:11 Dunkhan

you can change to en-GB by following the instructions here https://code.visualstudio.com/docs/getstarted/locales

It looks like there no longer is an en-GB language pack on the marketplace.

kslstn avatar Oct 25 '21 08:10 kslstn

It looks like there no longer is an en-GB language pack on the marketplace.

facepalm

Dunkhan avatar Oct 25 '21 22:10 Dunkhan

I too would like to be able to change the date format to match my system settings (Region: Australia). I'm less concerned about the time format

spg-iwilson avatar Dec 12 '21 02:12 spg-iwilson

Maybe we could just get the default changed to be compliant with international standards if it is too hard to allow localisation. https://en.wikipedia.org/wiki/ISO_8601

Dunkhan avatar Dec 12 '21 06:12 Dunkhan

@kslstn On vscodium I could still get the English (United Kingdom) language pack from the marketplace. I set --locale=en-gb as a parameter when launching the app, but the marketplace description mentions another way to set the locale. Not sure how this works for regular vscode.

I am still really looking forward to being able to customize the date and time format and set it to ISO.

os-locale wouldn't be good enough for many users anyway since it only reads LC_MESSAGES on POSIX systems. I have a diversity of locale settings, and for my timestamps, I would want LC_TIME read from my env.

Potentially useful information to implementing the customization: Gitlens is using the Moment.js format.

ls-1N avatar Apr 11 '23 15:04 ls-1N

Based on this issue in VSCode itself, it seems that they are just implementing the date formating directly using the toISO string method per the linked PR and custom string manipulation, perhaps the same thing could be done in this extension now too?

maks avatar Jun 20 '23 04:06 maks

Why don't they / you just fix it so one can choose date format one self?

hoegge avatar Jun 20 '23 06:06 hoegge