Handlebars subexpression in framework7 seems not to be working?

It seems that handlebars subexpression in framework7 are not working, and throw this error… handlebars expressions works just fine but a subexpression throw errors all the time!

I test all possibilities but it seems a problem somewhere not in the expression!

here my helpers:

Template7.registerHelper("ifCond", function (v1, operator, v2, options) {
  switch (operator) {
    case '==':
      return (v1 == v2) ? options.fn(this) : options.inverse(this);
    case '===':
      return (v1 === v2) ? options.fn(this) : options.inverse(this);
    ... // here all code for all cases

    default:
      return options.inverse(this);
  }
});


Template7.registerHelper('diffToSeconds', function (thisDayAvailability, todayis) {

  var thisDay = thisDayAvailability;
  var todayis = todayis;

  var times = {
    fromTime : thisDayAvailability.time[0],
    toTime : thisDayAvailability.time[1],
  }
  .... //here all the code for calculation

  var totalSeconds = Math.floor(hours * 60 * 60) + Math.floor(minutes * 60);
  return totalSeconds;
  
});

here my handlebar subexpression

          {{#ifCond (diffToSeconds this ../todayIs) ">=" "900"}}
          Yes
          {{/ifCond}}

diffToSeconds makes a calculation that needs to be passed are subexpression inside
ifCond for a comparison.

error in the console when using subexpression

SyntaxError: Unexpected token')'. Expected a property name after '.'. 

anyone know why this is happening?

thanks for any tips!

Subexpressions / nested helpers are not supported in Template7

is there a way to make this work in a different way in F7?

diffToSeconds returns only a calculated integer value that need to be compared with other value in this case 900 seconds and this needs to be run in order to show or hide a html block element in a virtual list comparing the seconds left of a timedate!

Is there another way to achieve this in F7?

{{#ifCond (diffToSeconds this ../todayIs) ">=" "900"}}

thanks

is there a way to support Handlebars subexpressions in f7? I really need to use subexpressions in my code to create a virtual list on the fly and show or hide some components that needs to be evaluated in that very moment when displaying the information!

thanks for any tips!

No, it won’t be added, because doesn’t really needed. You can just create more complex helper or just pre-format the data you pass to template. E.g. you can just create helper like:

{{#helperName this ../todayIs ">=" "900"}}

and handle 4 arguments in it

I will try to follow your suggestion but the problem is that in my case my products has a purchase time range and I want to hide and show products according the limit purchase time range daily and current local time at the moment of purchase and this has to happen when displaying them for instance if the product is on sale between 9:00-10:30am Monday and now it is 10:31 Monday for instance the product must be hidden so the customer cannot purchase a product that is not in the right time for purchase.

this is why diffToSeconds calculate the product purchase time for that day according the current day and time and returns seconds remaining according the current present time at that very moment, if the returned value of diffToSeconds is equal o higher of 900 seconds then the product can still be purchased and so…

this is why this subexpression below:

{{#ifCond (diffToSeconds this ../todayIs) ">=" "900"}}

I will see if this can be done as you mentioned it!
I hope to find a quick solution!
thanks!