Usage of $now variable in templates — Nosto Community

Usage of $now variable in templates

foobarfoobar Posts: 2Member
Hi

I'm having some confusion using $now variable in my templates.

The documentation says:
Current date and time in UTC with dd.MM.yyyy format by default. A possible use case would be in an if-clause to verify and check the current time. $now.isAfter(startingDate) where startingDate should be in ISO format e.g. "2011-12-24T00:00Z" (see ISO 8601).
I have a string with date which I would like to compare with current date but something like this apparently does not work:

#if($now.isAfter("2018-01-01T00:00Z"))

Then I have tried outputting the current date with either just $now or $now.toString() be both snippets are not converted and output as they are.

Is it a Nosto bug or am I doing something wrong?

Best regards

Comments

  • JacopoJacopo Posts: 47Walking Wisdom, Coding Expert admin
    Hello @foobar

    I am checking it now (no pun intended) and I am also having issues in printing it as it should.

    Please hold on a little bit more as I am asking our developers what the solution to this could be.

    If you tell me what the use case could be, I could also help you with a "plan B" in the meantime! :) 
  • JacopoJacopo Posts: 47Walking Wisdom, Coding Expert admin
    Hey @foobar

    our devs told me there was a bug that was making the variable printing itself rather than the date, as expected.

    This has been fixed and thanks to you for finding it



    Now try again what you wanted to and if you still need some help, we are here for you!  💪
  • foobarfoobar Posts: 2Member
    Works! Thanks!
Sign In or Register to comment.

Read our Terms&Conditions before commenting and posting