[Jifty-commit] r1963 - jifty/trunk/lib/Jifty/Manual

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Sep 14 19:30:20 EDT 2006


Author: nelhage
Date: Thu Sep 14 19:30:20 2006
New Revision: 1963

Modified:
   jifty/trunk/lib/Jifty/Manual/Cookbook.pod

Log:
Adding the time and date filters to the cookbook.


Modified: jifty/trunk/lib/Jifty/Manual/Cookbook.pod
==============================================================================
--- jifty/trunk/lib/Jifty/Manual/Cookbook.pod	(original)
+++ jifty/trunk/lib/Jifty/Manual/Cookbook.pod	Thu Sep 14 19:30:20 2006
@@ -56,6 +56,28 @@
     <link rel="alternate" type="application/atom+xml" title="Atom" href="/feed/atom" />
     <link rel="alternate" type="application/rss+xml" title="RSS" href="/feed/rss" />
 
+=head2 Use date or time objects with the database?
+
+On your columns, specify either
+
+    filters are 'Jifty::DBI::Filter::DateTime'
+
+for a timestamp (date and time), or
+
+    filters are 'Jifty::DBI::Filter::Date'
+
+for just a date. Jifty will then automatically translate to and from
+DateTime objects for you when you access the column on your
+model. Additionally, if you add:
+
+    filters are qw(Jifty::Filter::DateTime Jifty::DBI::Filter::Date)
+
+Jifty will inspect the model's
+L<current_user|Jifty::Manual::AccessControl> for a C<time_zone>
+method, and, if it exists, set the retrieved DateTime object's time
+zone appropriately. All dates are stored in UTC in the database, to
+ensure consistency.
+
 =head2 Emulate 'created_on' field like Rails ?
 
 In Rails, if you have a field named 'created_on', it's automatically


More information about the Jifty-commit mailing list