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

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

Ouverte
#284 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
398
Forks
120
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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?

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Start at addon/helpers/moment-format.js lines 28-35 and inspect how the helper distinguishes an omitted format from a falsy second argument. Check the existing helper tests, if available, for default-format behavior and explicit formats; done means a falsy format follows the configured default without changing explicit formatting.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript
Domaine
frontend
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
48/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.