Gift voucher - validity from - wrong date in future
solved

By Patryk Wróbel, 9 months ago

Hello, Since the beginning I am facing this issue as above. I have rule which creates voucher for customer for adding revierw (in revws module), exactly after approving. But I don't know what I am doing wrong because always I get validity date from which is +5.5 years from now in future (66 months) if I count well. For example:

By Petr Hucik, 9 months ago

This field Valid from (days) can be a little bit confusing -- it expect numerical value, not date. Semantics of this field is the number of days from today. If you enter 0, it means the voucher will be valid from today. If you enter 1, it will be valid from tomorrow, etc.

When you enter date field, php will silently do its conversion magic, and converts date value '2024-01-01' to number 2024, which means 2024 days from today. Which is, indeed, sometimes in the year 2029 :)

By Patryk Wróbel, 9 months ago

Oh yeees, indeed. Now I checked vouchers which were made today and then checked what data is 2024 days from today an it is exactly the date which finally can be found in "Valid from" in generated voucher...

I would have never found this issue I think. Thank you.

So in module Consequences I have to set "Valid from" on constant value 0, right? :) If I want it working immediately from now of course.