Module: Zena::Use::Dates::ViewMethods
Instance Method Summary collapse
-
#main_date(tz = visitor.tz) ⇒ Object
default date used to filter events in templates.
- #parse_date(string, format = nil, tz = nil) ⇒ Object
Methods included from FormTags
Methods included from Common
Instance Method Details
#main_date(tz = visitor.tz) ⇒ Object
default date used to filter events in templates
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/zena/use/dates.rb', line 169 def main_date(tz = visitor.tz) @main_dates ||= {} @main_dates[tz] ||= begin if params[:date] if date = params[:date].to_utc(_(DATETIME), tz) date else # FIXME: when date parsing fails: show an error, not a 500... Node.logger.warn "Could not parse 'date' parameter: #{params[:date].inspect}." # malformed url... 404 ? Time.now.utc end else # no 'date' parameter Time.now.utc end end end |