Actions

QS

Date max: Difference between revisions

From LimeSurvey Manual

(Small error in date example.)
m (Bug #10011 follow up)
Line 10: Line 10:


<!--T:4-->
<!--T:4-->
This question attribute can be used to set the maximum value for the calendar question. It applies to both, the popup-variant of the calendar and the dropdown fields.
This question attribute can be used to set the minimum value for the date question (in Y-m-d format or any English valid string) . It applies to both, the popup-variant of the calendar and the dropdown fields.
Besides validation via Expression Manager, the selection of days in the popup calender is also limited accordingly. The year in popup calendar is not updated if Expression use Question in same page.


<!--T:5-->
<!--T:5-->
Line 16: Line 17:


<!--T:6-->
<!--T:6-->
#'''Any date value in format YYYY-MM-DD''' (eg., 2013-08-24)
* Any date value in format YYYY-MM-DD (eg., 2013-08-24)
#'''Any year value'''
* Any year value
#'''Reference to another date/time question''' (eg., dateofbirth)
* Any English string : "now", "-10 years", "tomorrow"
#'''Expressions''' With expressions, a maximum date can be dynamically calculated. For example, you can use a date from a previous answer + 4 weeks as a maximum for the present question by entering: date("Y-m-d H:i",strtotime(departuredate)+4*60*60*24*7).  Another example: you can set a restriction for "allowing any date not later than today" by entering: date('Y-m-d'). By entering date("Y-m-d", strtotime("now")+60*60*24*2), dates up to two days from today are allowed.
* Reference to another date/time question : AnotherDateQuestion
* Expressions : With expressions, a minimum date can be dynamically calculated. For example, you can use a date from a previous answer + 3 days as a minimum for the present question by entering: date("Y-m-d",strtotime(departuredate)+3*60*60*24).


<!--T:7-->
<!--T:7-->

Revision as of 13:18, 17 December 2015


Maximum date (date_max) (New in 2.05 )

Description

This question attribute can be used to set the minimum value for the date question (in Y-m-d format or any English valid string) . It applies to both, the popup-variant of the calendar and the dropdown fields. Besides validation via Expression Manager, the selection of days in the popup calender is also limited accordingly. The year in popup calendar is not updated if Expression use Question in same page.

Valid values

  • Any date value in format YYYY-MM-DD (eg., 2013-08-24)
  • Any year value
  • Any English string : "now", "-10 years", "tomorrow"
  • Reference to another date/time question : AnotherDateQuestion
  • Expressions : With expressions, a minimum date can be dynamically calculated. For example, you can use a date from a previous answer + 3 days as a minimum for the present question by entering: date("Y-m-d",strtotime(departuredate)+3*60*60*24).