nortakales / vs-code-qalc

Interactive scratchpad calculator for VS Code
MIT License
70 stars 2 forks source link

Support for Day-Month-Year date format #6

Open leehadassin opened 2 years ago

leehadassin commented 2 years ago

Hi,

Love the extension.

Any chance of providing an option to change the date format?

Thanks from Australia

Lee

nortakales commented 2 years ago

This is possible albeit slightly complicated. Right now the string is being passed directly into new Date(...). It seems to recognize year/month/day, and month/day/year by default. I think the correct solution will be to manually parse dates myself, and pass individual date/time components to the Date constructor. I will get to this eventually but it isn't super high priority.

VulumeCode commented 2 years ago

It is possible to use ISO8601 dates, which has year-month-day like so: date(1995-12-17 03:53:00).

What's really needed is a Date output format option. It seems now it just uses locale for output. This means you can get confusing output like: date(01/23/4567) = 23/1/4567 and you can make copypaste errors.

Should be much easier to implement than custom parsing too.