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

Odd & inconsistent behaviour from moment-format and is-after helpers

Aperta
#246 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
398
Fork
120
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I have something like this in a template:
```
{{#each things as |thing|}}
{{d3-graph
(pipe
(d3-text (moment-format thing.dateTime 'H:mm'))
(d3-attr 'class'
(if
(is-after now thing.dateTime)
'late'
'not-late'
)
)
)
tagName='text'}}
{{/each}}
```

### The inconsistent
The **is-after** helper logs the `an empty value (null, undefined, or "") was passed to moment-format` warning while the **moment-format** helper renders without any warning. Everything works as expected; the time is rendered with the _late_ class (if now is after dateTime)... but with an ugly console warning :-(.

### The odd
In the same conditions, if I set `allow-empty=true` on the **is-after** helper, the text is rendered with the _not-late_ class (instead of _late_).

It seems like the comparison helper fails with `allow-empty=true` and looking at https://github.com/stefanpenner/ember-moment/blob/master/addon/utils/helper-compute.js I don't really understand why `allowEmpty` is taken into account in a comparison helper.

Tested with v7.3.1 on ember v2.14.1 & v2.13.4

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.