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

Display an optional message when date is null/invalid/undefined

Ouverte
#379 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

The default behavior when the helper receives an invalid input is to return **Invalid Date**.

Optionally, from docs we can allow empty dates to be passed but it returns nothing:

> ```{{moment-format '' allow-empty=true} {{!-- --}}```

But it could help a lot in my case if I could define an optional message. I'm currently doing this via a template helper:

```js
export function formattedDate([date]) {
return date ? moment(date).format('DD/MM/YY') : 'indisponível';
}

export default helper(formattedDate);
```

If possible, I'd like to eliminate this helper.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Start with the moment-format helper and the documentation examples for allow-empty, then trace how empty, invalid, and undefined inputs are handled. Done means an optional message can be specified for those inputs while the existing default and allow-empty behavior remain documented and tested.

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

Évaluation

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

Recevez les nouvelles issues par e-mail

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