hi,
Is there someone to help me on constraint with date field.
I've a datefield and i want that the user put a date that would be the d-day or 5 days before the d-day max.
I've tried with : >now() +5*24*60*60*1000, but does not function.
Thank you for your help.
A french guy!
Solved! Go to Solution.
Hi Louis,
So the valid dates are from today -5 days? In that case you would need a compound statement to set lower and upper bounds:
int(.) >= int(today()) - 5*24*60*60*1000 and int(.) <= today(.)
So it must be greater than or equal to 5 days ago and less than or equal to today.
Hi Ismael,
Thank you for your help. I've tried but still does not function
see in the attached video: https://framadrop.org/r/EtNaumkzlh#FgGTNJK0byjyhHCA4dmY7rWSZVYSq28AGj7emVtR+vQ=
Hi Louis,
There seems to be a type conversion issue causing the problem. can you try the following constraint:
int(.) < int(today()) + 5*24*60*60*1000
The addition should work correctly with everything being an integer.
Hi James,
Thank you for your answer. I would never find it alone !
It seems to work. But what i wanted to do was to forbidden a date after today and more than 5 days before today
For exemple, we are the 15/06/2017
The user can had 10/06 , 11/06, 12/06, 13/06, 14/06 and 15/06 but not more.
What would be the constrain for that?
Regards
Hi Louis,
So the valid dates are from today -5 days? In that case you would need a compound statement to set lower and upper bounds:
int(.) >= int(today()) - 5*24*60*60*1000 and int(.) <= today(.)
So it must be greater than or equal to 5 days ago and less than or equal to today.
PERFECT
THANK YOU VERY MUCH!
It works great