Skip to content

Truncate milliseconds shorthand in ISO#1412

Open
EzeGmnz wants to merge 3 commits intomoment:masterfrom
EzeGmnz:master
Open

Truncate milliseconds shorthand in ISO#1412
EzeGmnz wants to merge 3 commits intomoment:masterfrom
EzeGmnz:master

Conversation

@EzeGmnz
Copy link
Copy Markdown

@EzeGmnz EzeGmnz commented Apr 2, 2023

Adds a new parameter to DateTime#toISO and toISOTime called truncateMilliseconds which will remove the milliseconds from the format, irrespective of their value.

Added tests

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Apr 2, 2023

CLA Missing ID

  • ✅login: EzeGmnz / (fdf6016)
  • ❌ The commit (615ccf8, d1c8e29). This user is authorized, but they must confirm their affiliation with their company. Start the authorization process by clicking here, click "Corporate", select the appropriate company from the list, then confirm your affiliation on the page that appears. For further assistance with EasyCLA, please submit a support request ticket.

@erdnaxeli
Copy link
Copy Markdown

Hi, any news about this? this would be very helpful. Thanks!

@BalusC
Copy link
Copy Markdown

BalusC commented Nov 21, 2024

I see this is still not merged while this is certainly useful.

For the time being, this can be work arounded as follows:

dateTime.startOf("second").toISO({ suppressMilliseconds: true });

@Konafets
Copy link
Copy Markdown

What is the status of this issue?

@dobon
Copy link
Copy Markdown
Contributor

dobon commented May 27, 2025

What is the status of this issue?

This functionality is added by #1670 which will be released on the next release of luxon (soon, I think?). It adds an optional precision parameter for toISO, which you can configure to truncate milliseconds reliably.

This PR can be closed as duplicate.

@NogaMan
Copy link
Copy Markdown

NogaMan commented Jun 4, 2025

When is the next release of luxon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants