adopted-ember-addons / adopted-ember-addons/ember-moment

Falsy second parameter for `moment-format` doesn't use default format

オープン
#284 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
398
フォーク
120
PR マージ指標
30日以内にマージされた PR はありません

説明

Maybe I'm wrong but if the value of the second parameter passed to `moment-format` is a falsy value, I'd expect the date to be displayed in the default format.

That's currently not the case as the code checks the number of parameters passed explicitly and only uses `moment.outputFormat` (the default format set in the configuration):
https://github.com/stefanpenner/ember-moment/blob/v7.7.0/addon/helpers/moment-format.js#L28-L35

If it worked as I describe, the following:

```hbs
{{#with currentUser.user.dateFormat as |format|}}
{{moment-format date format}}
{{else}}
{{moment-format date}}
{{/with}}
```

could be written as:

```hbs
{{moment-format date format}}
```

Is this the intended behavior or can we get the default format in the case I described?

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。