Contextual |
|
| see parse_date, show, store, functions | |
This method retrieves the date passed as argument in the url or the current time.
some/url?date=2011-04-20T17:09
The date argument is encoded with the ISO format without timezone information:
"%Y-%m-%dT%H:%M:%S"
Contextual timezone
Please read this paragraphe…
If you use a contextual timezone (to present a calendar for public events for example), you should use date(tz) to ensure that the url date is parsed with the contextual timezone instead of the visitor’s.
<r:default tz='America/New_York'> <h3>Events on <r:date format='%m %d'/> (<r:tz/>)</h3> <ul do='events where event_date.date = #{date(tz)} in project'> <li do='each'>...</li> </ul> </r:default>
If you are not familiar with the ”.date” macro in the query above, please read the chapter on SQLiss functions.
Usage in view
Example to display the date (not very useful on its own):
<b do='date' format='%Y-%m-%d'/>
Used to filter elements:
<ul do='notes where log_at.date = #{date} in site'> ... </ul>
The above query uses the date SQLiss function.