adopted-ember-addons / ember-moment

MIT License
400 stars 122 forks source link

Helper moment doesn't format? #293

Closed aaronlelevier closed 5 years ago

aaronlelevier commented 5 years ago

The readme example with moment only doesn't seem to apply formatting. Example from README:

Example

{{moment '2018-11-05T19:33:06.753652Z' 'MM-DD-YYYY'}} 

Results in Mon Nov 05 2018 00:00:00 GMT-0800

With moment-format this works.

Example

{{moment-format '2018-11-05T19:33:06.753652Z' 'MM-DD-YYYY'}}

Results in: 2018-11-05

leobut commented 5 years ago

This is desired behavior.

Have a look at the documentation here: https://github.com/stefanpenner/ember-moment#moment

Your first example should be read as: {{moment 'this is my date value' 'this is the format of my date'}} The output will always be in the default format. If you just want to format a date, use {{moment-format}}

And your second example should be read as: {{moment-format 'this is my date value' 'this is the format how the output should look like'}} And if your date has a special format, use the third parameter for this handlebar to define that also. See https://github.com/stefanpenner/ember-moment#moment-format