Closed rxaviers closed 7 years ago
Some API ideas
option.parts
to dateFormatter (and formatDate) that takes true or false (default). Downside: return different types depending on the options...dateToPartsFormatter
and formatDateToParts
. Downside: additional work for static compiler.For the record, @jzaefferer and I have discussed these options and we leaned towards option 2. It seems the one the fits the best for globalize in a way that keeps API simple. Suggestions and ideas are welcome...
I am by no means an expert here but reviewing the information you have provided, I would also lean toward option option 2 if that helps at all.
Thank you @kborchers, it definitely helps.
Context
Formatter is designed to provide an opaque string as an output that is not meant to be manipulated by the consumer, which makes impossible for UX/design using rich formatting, e.g.,
"May <strong>05</strong> 2014"
,"09:49 <i>pm</i>"
, and"<strong>Monday</strong>, 09/12/2015"
.Goal
Expose format to parts similarly to Ecma-402 Intl.DateTimeFormat.prototype.formatToParts().
References