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

Support for milliseconds #13

Open
Curetix opened this issue Feb 19, 2024 · 2 comments
Open

Support for milliseconds #13

Curetix opened this issue Feb 19, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Curetix
Copy link

Curetix commented Feb 19, 2024

Hi, I'd like to request the possibility to explicitly work with milliseconds during the various operations this library offers. The uppercase S is a common template token for parsing and formatting milliseconds, with the ability to vary the number of decimal places using multiple S (e.g. .S, .SS, .SSS).

Parsing a datetime with milliseconds already works when not using a custom format, for example parse("2022-08-03 16:56:54.477") returns the appropriate date object 2022-08-03T14:56:54.477Z.

Another thing I encountered is that tzDate seems to remove the milliseconds part of the date, both tzDate("2022-08-03 16:56:54.477", "Europe/Berlin") and tzDate(parse("2022-08-03 16:56:54.477"), "Europe/Berlin") return 2022-08-03T14:56:54.000Z.

@hrynevychroman
Copy link
Contributor

I looked to this and need some help from OG devs inside this repo, so let's look into this.

Firstly, I see that [email protected] interface DateTimeFormatPartTypesRegistry don't support fractionalSeconds at all:

image

Also I see that when we parsing date, function date setMilliseconds to zero, so I think this repo not configured to work with milliseconds at all 🥲

image

@justin-schroeder justin-schroeder added the enhancement New feature or request label Feb 23, 2024
@cusxio
Copy link

cusxio commented Jul 17, 2024

It would have been helpful if this limitation was mentioned in the documentation. I only realized it after porting to this library midway through my app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants