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

Helpers without context fail to render correctly #1092

Open
kt12359 opened this issue Feb 27, 2024 · 0 comments
Open

Helpers without context fail to render correctly #1092

kt12359 opened this issue Feb 27, 2024 · 0 comments

Comments

@kt12359
Copy link

kt12359 commented Feb 27, 2024

Hi,

I am debugging an issue when trying to use a named variable and a custom helper without a supplemental json context in the sub-context of a #with block.

{{#with ($timeBetween ($now) "2024-03-05 08:00:00") as |days|~}}
  There are {{days}} between {{$now}} and 2024-03-05.
{{/with}} 

Is rendered as:
There are 6 between and 2024-03-05.

I stepped through the code in a debugger and can confirm that the handlebars library isn't making a second call to the $now helper function. However, if I supply some fake context:

{{#with ($timeBetween ($now) "2024-03-05 08:00:00") as |days|~}}
  There are {{days}} between {{$now what}} and 2024-03-05.
{{/with}} 

... it renders correctly. This also works:
{{#with ($timeBetween ($now) "2024-03-05 08:00:00") as |days|~}} There are {{days}} between {{#$now}}{{/$now}} and 2024-03-05. {{/with}}

But it does seem like this is a bug, because the method call without any arguments should still be recognized.

Thank you!

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

1 participant