gitHistoryVSCode icon indicating copy to clipboard operation
gitHistoryVSCode copied to clipboard

[BUG] Date format in Git file history shows as "M/dd/yyyy" and does not adopt to system settings

Open ozmium opened this issue 1 year ago • 2 comments

Describe the Bug

The date format used to display Git commit dates in the File History tab is shown as something like "5/11/2023". This is a very confusing and ambiguous format, which is only used in USA and almost no other countries. We cannot tell whether this means "5 November 2023" or 11 May 2023".

Steps To Reproduce

  1. Clone a Git repository
  2. Open the repo folder in Microsoft Visual Studio Code
  3. Open a file in the git project. Right click on the editor tab -> select "Git: File History View". Or run command "git: view history (git log)"

Actual Behavior

  • The date format used in the history view displays as "M/dd/YYYY", for example like "5/11/2023".
  • There is no way to change this format.
  • It's confusing and ambiguous. We cannot tell whether the example means "5 November 2023" or 11 May 2023".
  • It doesn't follow the system settings, or what other apps do.

Expected Behavior

  • The date format used in the history view should follow the system settings. For example, it should display as "11 May 2023" if that was set in the Language And Region system preferences.
  • If the system date format cannot be retrieved, then an unambiguous and clearer default format should be used which uses a word for the month instead of all numbers. Examples are: "May 11, 2023" or "11 May 2023". Formats like "5/11/2023" shold be avoided.
  • There should be a configurable setting in the extension for the user to change the date format, using up to 5 different options:
    • "MMMM dd, YYYY" (default). Example: "October 12, 2023"
    • "d MMMM YYYY" Example: "4 January 2023" (the format used by most countries outside USA. This could be the default)
    • "YYYY-MM-dd" Example: "2023-01-02"
    • "dd/MM/YYYY" Example: "02/05/2023" (this means 2 May 2023)
    • "MM/dd/YYYY" Example: "05/02/2023" (this means 2 May 2023)
  • The configuration option is particularly important, because it seems like there is a bug in Electron where it doesn't follow the system settings for new Date().toLocaleDateString(). See: https://github.com/microsoft/vscode/issues/56995 . So the user would need an option to override the bug.

Environment

  • OS: MacOS 12.5.1 Monterey, probably Windows 10/11 and Ubuntu Linux as well
  • Visual Studio Code version: 1.77.3 or 1.73.1 (or any recent version)
  • Extension: Git History - version: v0.6.20 or v0.6.19

ozmium avatar May 11 '23 15:05 ozmium

This appears to be a wider issue with all VSCode extensions, as this closed ticket suggests. I've opened a new ticket in the hope they will address it. In the meantime, I think a workaround in this extension should be possible?

roblframpton avatar Jul 06 '23 09:07 roblframpton

Please can you just hardcode the date to a normal ISO format like YYYY-MM-DD, until localization customization is done? It's very weird to use this awful USA date format that makes no sense to anyone else in the world.

RichardJECooke avatar Aug 14 '23 09:08 RichardJECooke