purescript-contrib / purescript-formatters

Formatting and printing for numeric and date/time/interval values
Apache License 2.0
41 stars 30 forks source link

Escapes placeholders that contain valid format characters #74

Closed ntwilson closed 1 year ago

ntwilson commented 3 years ago

Description of the change Fixes #70. Placeholders that contain any valid format characters are escaped via square brackets. I.e., Placeholder " YYYY " will become "[ YYYY ]", following the momentjs formatting rules. Notably, this PR makes bracket characters invalid in a Placeholder string, since all brackets are used exclusively for escaping. I could add support for escaping the brackets, i.e., parseFormatString "\[YYYY\]" == Right (Placeholder "[" : YearFull : Placeholder "]" : Nil) though I saw no of support for this behavior from momentjs, which seems to be the inspiration for this library's format strings.


Checklist:

garyb commented 1 year ago

Hey! Sorry this got ignored, as it and your other PR look like great additions. Would you mind resolving the conflicts there are in this now and I'll get it included? (Or I'll update it soon™ if you no longer have the time/inclination).

ntwilson commented 1 year ago

Thanks for the update! Yeah I'd love to get these PRs back in working order, when time permits.

ntwilson commented 1 year ago

Hey @garyb, sorry for the delay there but I think this PR (and #73) are ready to go now!

garyb commented 1 year ago

Thanks very much!