[Jifty-commit] r4666 - in jifty/trunk: lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Dec 12 23:59:15 EST 2007


Author: sartak
Date: Wed Dec 12 23:59:14 2007
New Revision: 4666

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/DateTime.pm

Log:
 r48954 at onn:  sartak | 2007-12-12 23:59:05 -0500
 Jifty::DateTime::is_date method, which tells whether the given J:DT is only a date


Modified: jifty/trunk/lib/Jifty/DateTime.pm
==============================================================================
--- jifty/trunk/lib/Jifty/DateTime.pm	(original)
+++ jifty/trunk/lib/Jifty/DateTime.pm	Wed Dec 12 23:59:14 2007
@@ -248,6 +248,26 @@
     return $ymd;
 }
 
+=head2 is_date
+
+Returns whether or not this C<Jifty::DateTime> object represents a date
+(without a specific time). Dates in Jifty are in the floating time zone and
+are set to midnight.
+
+=cut
+
+sub is_date {
+    my $self = shift;
+
+    # all dates are in the floating time zone
+    return 0 unless $self->time_zone->name eq 'floating'
+
+    # all dates are set to midnight
+    return 0 unless $self->hms eq '00:00:00';
+
+    return 1;
+}
+
 =head1 WHY?
 
 There are other ways to do some of these things and some of the decisions here may seem arbitrary, particularly if you read the code. They are.


More information about the Jifty-commit mailing list