From ac63dcac92ce61d11fc0a01bedb38c343f4809e1 Mon Sep 17 00:00:00 2001 From: reborg Date: Tue, 23 Jun 2009 14:56:25 +0200 Subject: [PATCH] fixed wrong regexp for pomodoros in other timezones --- lib/pomodori/extensions/timestamp.rb | 4 ++-- test/pomodori/exensions/timestamp_test.rb | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/pomodori/extensions/timestamp.rb b/lib/pomodori/extensions/timestamp.rb index 8ba86bd..11cd8cc 100644 --- a/lib/pomodori/extensions/timestamp.rb +++ b/lib/pomodori/extensions/timestamp.rb @@ -2,7 +2,7 @@ class String - TIMESTAMP = /^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\s-\d{4}$/ + TIMESTAMP = /^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\s[-+]\d{4}$/ def flatten_date return self[0..9].gsub("-", "") if self.timestamp? @@ -18,4 +18,4 @@ def strftime(format) time.strftime(format) end -end \ No newline at end of file +end diff --git a/test/pomodori/exensions/timestamp_test.rb b/test/pomodori/exensions/timestamp_test.rb index 73ab44a..487f115 100644 --- a/test/pomodori/exensions/timestamp_test.rb +++ b/test/pomodori/exensions/timestamp_test.rb @@ -13,8 +13,9 @@ def setup "2009_05_11 11:06:43 -0500".timestamp?.should be(false) end - it "extracts the the date" do + it "extracts the date" do @ts.flatten_date.should == "20090511" + "2009-02-16 05:25:00 +0100".flatten_date.should == "20090216" end it "returns empty string if not ts" do