purescript-contrib / purescript-formatters

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

Moment.js-style escaping of literal text in date/time formats #39

Closed stefanholzmueller closed 6 years ago

stefanholzmueller commented 6 years ago

See https://github.com/moment/momentjs.com/blob/master/docs/moment/04-displaying/01-format.md#escaping-characters

P.S.: If anyone knows a neater way to construct a parser for this, I'd be happy to learn about it.

stefanholzmueller commented 6 years ago

By reading #22 I just realized that one can avoid the string parsing alltogether and use FormatterCommands directly and include a Placeholder with the desired literal text. This is arguably safer and more flexible.

Also, adding escaping would be a breaking change. I don't think this is really needed.