Reputation: 189
{{#each month in showMonths}}
<td>
{{#each orderGetter}}{{ month.currMonth }} :: {{period}}{{/each}}
</td>
{{/each}}
showMonths is an array of dates. It loops and the idea is that it then matches dates retrieved by the orderGetter template helper. For the purpose of debugging the above simply generates the two values to be compared. This results in:
Mon Feb 01 2016 00:00:00 GMT+0000 :: Mon Feb 01 2016 00:00:00 GMT+0000
Using an equality template helper to compare the 2 dates, it always returns false. Even though as you can see they're identical. This also happens when I run the dates through moment in the equality helper.
The equality code:
{{#each month in showMonths}}
<td>
<input type="text" min="0" class="form-control" value="{{#each orderGetter}}{{#if matcher month.currMonth period}}foo{{/if}}{{/each}}">
</td>
{{/each}}
Template.registerHelper('matcher', function(a, b) {
return a ===b;
});
Kinda pulling my hair out.
Any ideas?
Thank you
Upvotes: 0
Views: 240
Reputation: 20768
use ==
not ===
here
===
implies it is the SAME object, while ==
checks it is equal.
Upvotes: 0