00975: (:if date:) inconsistent with page variables

Summary: (:if date:) inconsistent with page variables
Created: 2007-09-11 11:01
Status: Closed - not a bug
Category: Bug
From: JonHaupt
Assigned:
Priority: 5
Version: 2.2 beta
OS:

Description: I have created a page variable called BlogDate2 which produces the page's creation time in the format YYYY-MM-DD.

I'm confused by how this page variable works with (:if date:).

Assuming I created the page today:

(:if date yesterday..tomorrow:) this is true.
(:if date "-1 month"..tomorrow:) this is true.
(:if date yesterday..tomorrow {*$BlogDate2}:) this is true.
(:if date "-1 month"..tomorrow {*$BlogDate2}:) this is not true.

BlogDate2:{(ftime when=today fmt="%F")}
* BlogDate2 is "{$:BlogDate2}"
* (:if date yesterday..tomorrow:) true (:else:) %red%false (:ifend:)
* (:if date "-1 month"..tomorrow:) true (:else:) %red%false (:ifend:)
* (:if date yesterday..tomorrow {*$:BlogDate2}:) true (:else:) %red%false (:ifend:)
* (:if date "-1 month"..tomorrow {*$:BlogDate2}:) true (:else:) %red%false (:ifend:)
* (:if date "-1month"..tomorrow {*$:BlogDate2}:) true (:else:) %red%false (:ifend:)

BlogDate2:2024-11-23

  • BlogDate2 is "2024-11-23"
  • true
  • true
  • true
  • false
  • true

Try eliminating the spaces from "-1 month" or using something like "-30days":

BlogDate3:{(ftime today %F)}

* (:if date "-1month"..tomorrow {*$:BlogDate3} :) true (:else:) %red%false (:ifend:)
* (:if date "-30days"..tomorrow {*$:BlogDate3} :) true (:else:) %red%false (:ifend:)

BlogDate3:2024-11-23

  • true
  • true

--Pm

ah, how intriguing. well, that does seem to work. Thanks!