FreeMarker Current Date Comparison

前端 未结 4 2545

Is it possible to do date comparisons against the current date in a freemarker template without passing the current date into the template?

4条回答
  •  春和景丽
    2021-02-20 13:46

    In case someone else has this issue.

    I was comparing 2 dates

    [#assign .now?date lte today?date]
    

    (they both were 10/10/2019)

    but for some reason it was false even though it was equal, so what I had to do was

    [#assign .now?string["dd/MM/yyyy"]?date lte today?date]
    

提交回复
热议问题