adopted-ember-addons / adopted-ember-addons/ember-moment
Display an optional message when date is null/invalid/undefined
- Lingua principale
- JavaScript
- Stelle
- 398
- Fork
- 120
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- frontend
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100