Building on the get_moment()
method, the simplified code below calculates dates relative to the current date without requiring the respondent to answer a date question.
TODAY. Today's date
type: text
dvalue: $_moment->stringify
YESTERDAY. Yesterday's date
type: text
dvalue: $_moment->minus_days(1)->stringify
WEEK. Next week
type: text
dvalue: $_moment->plus_weeks(1)->stringify
MONTH. Next month
type: text
dvalue: $_moment->plus_months(1)->stringify
YEAR. Next year
type: text
dvalue: $_moment->plus_years(1)->stringify
YEAR2. In two years
type: text
dvalue: $_moment->plus_years(2)->stringify
Note: Chaining multiple object methods together could result in a parser caution, but they will function properly.
Details
- This method can be used for days, weeks, months, and years.
- Both plus and minus functionality can be used to add to or subtract from the current date.
- Adjustments can be made for multiple days, weeks, months, or years by using a value greater than 1.
- The results returned by this method are in real time.
Additional examples
Using as a 'type: date' question
NOW. right now, as a date
type: date
dvalue: $_moment->now()
Comments
0 comments
Please sign in to leave a comment.