[Jifty-commit] r4077 - in jifty/trunk: lib/Jifty
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Tue Sep 11 13:33:47 EDT 2007
Author: sartak
Date: Tue Sep 11 13:33:46 2007
New Revision: 4077
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/DateTime.pm
Log:
r42507 at onn: sartak | 2007-09-11 12:19:53 -0400
Use ->clone on DateTime objects to avoid possible DST issues, etc
Modified: jifty/trunk/lib/Jifty/DateTime.pm
==============================================================================
--- jifty/trunk/lib/Jifty/DateTime.pm (original)
+++ jifty/trunk/lib/Jifty/DateTime.pm Tue Sep 11 13:33:46 2007
@@ -125,21 +125,19 @@
my $ymd = $self->ymd;
my $tz = $self->current_user_has_timezone || $self->time_zone;
-
- my $rel = Jifty::DateTime->now();
- $rel->set_time_zone( $tz );
+ my $rel = DateTime->now( time_zone => $tz );
if ($ymd eq $rel->ymd) {
return "today";
}
- $rel->subtract(days => 1);
- if ($ymd eq $rel->ymd) {
+ my $yesterday = $rel->clone->subtract(days => 1);
+ if ($ymd eq $yesterday->ymd) {
return "yesterday";
}
- $rel->add(days => 2);
- if ($ymd eq $rel->ymd) {
+ my $tomorrow = $rel->clone->add(days => 1);
+ if ($ymd eq $tomorrow->ymd) {
return "tomorrow";
}
More information about the Jifty-commit
mailing list