[Jifty-commit] jifty branch, master, updated. 476a2e53f08a3e29198e14960f39c41fc3a08364
Jifty commits
jifty-commit at lists.jifty.org
Mon Mar 29 16:01:24 EDT 2010
The branch, master has been updated
via 476a2e53f08a3e29198e14960f39c41fc3a08364 (commit)
from 5b6dfdb01b0f66abaf39e27986d35f94419f102d (commit)
Summary of changes:
lib/Jifty/DateTime.pm | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit 476a2e53f08a3e29198e14960f39c41fc3a08364
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Mon Mar 29 16:01:23 2010 -0400
Don't add/subtract 1 day because of DST errors
diff --git a/lib/Jifty/DateTime.pm b/lib/Jifty/DateTime.pm
index 8129396..ec25dd3 100644
--- a/lib/Jifty/DateTime.pm
+++ b/lib/Jifty/DateTime.pm
@@ -326,6 +326,10 @@ Returns the date given by this C<Jifty::DateTime> object. It will display "today
for today, "tomorrow" for tomorrow, or "yesterday" for yesterday. Any other date
will be displayed in ymd format.
+We currently shift by "24 hours" to detect yesterday and tomorrow, rather than
+"1 day" because of daylight saving issues. "1 day" can result in invalid local
+time errors.
+
=cut
sub friendly_date {
@@ -342,13 +346,13 @@ sub friendly_date {
}
# Is it yesterday?
- my $yesterday = $rel->clone->subtract(days => 1);
+ my $yesterday = $rel->clone->subtract(hours => 24);
if ($ymd eq $yesterday->ymd) {
return "yesterday";
}
# Is it tomorrow?
- my $tomorrow = $rel->clone->add(days => 1);
+ my $tomorrow = $rel->clone->add(hours => 24);
if ($ymd eq $tomorrow->ymd) {
return "tomorrow";
}
-----------------------------------------------------------------------
More information about the Jifty-commit
mailing list