Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jdurand opened this issue Jul 27, 2017 · 1 comment
Open

Comments

@jdurand
Copy link

jdurand commented Jul 27, 2017

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

@jasonmit
Copy link
Collaborator

Thanks for reporting, I will look into this to see what can be done to improve consistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants