formkit / tempo

📆 Parse, format, manipulate, and internationalize dates and times in JavaScript and TypeScript.
https://tempo.formkit.com
MIT License
2.34k stars 30 forks source link

FeatureReuet: Support for timezone format +-HH:mm in format token. #46

Closed Toru-Takagi closed 5 months ago

Toru-Takagi commented 6 months ago

Thank you for addressing #38.

Regarding #38, when formatting, the timezone becomes +-HHmm. I would be happy if I cloud also specify +-HH:mm.

Are there any plans to address this. If it is addressed, what kind of Format Token is expected to be used?

justin-schroeder commented 6 months ago

Good question. In general Id like to follow dayjs style tokens (I prefer them to date-fns). However, when writing this library I used Z to indicate +-HHmm where in dayjs Z indicates +-HH:mm. So it seems I’ve stepped in it a bit there. I would certainly be willing to concede this and issue a breaking change in 0.1 (since we are pre 1.0) to address this.

So in summary we should align with dayjs here:

token format
Z +-HH:mm
ZZ +-HHmm

Happy to accept a pull request for this if someone wants to tackle it before I get to it. That said we need to make sure both format and parse are able to handle this new token (it will need its own "part")