I would like to have date formatted like here on SO: "Feb 6, '14".
I cannot put the apostrophe there before the number 14.
I tried the following formatter strings:
{{model.since | date:'MMM d, \'yy'}}
{{model.since | date:'MMM d, 'yy'}}
{{model.since | date:"MMM d, 'yy"}}
{{model.since | date:"MMM d, 'yy"}}
The apostrophe is not displayed.
How can I put the apostrophe there?
From the documentation on date:
In order to output single quote, use two single quotes in a sequence (e.g. "h 'o''clock'").
Since a string literal must also be enclosed in single quotes, you need four single quotes in a row. And since you're using single quotes in your format, you need to enclose the entire format string with double quotes, rather than single quotes.
Thus, your formatter string should be {{model.since | date:"MMM d, ''''yy"}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With