remove fortnight support for now
authorChuck Hagenbuch <chuck@horde.org>
Tue, 3 Feb 2009 04:38:33 +0000 (23:38 -0500)
committerChuck Hagenbuch <chuck@horde.org>
Tue, 3 Feb 2009 04:38:33 +0000 (23:38 -0500)
framework/Date_Parser/lib/Horde/Date/Parser/Locale/Base.php
framework/Date_Parser/lib/Horde/Date/Parser/Locale/Base/Repeater.php
framework/Date_Parser/lib/Horde/Date/Parser/Locale/Base/Repeater/Fortnight.php [deleted file]

index e2ea002..7e241f5 100644 (file)
@@ -425,7 +425,7 @@ class Horde_Date_Parser_Locale_Base
         /*
           # span =
           # case true
-          # when [RepeaterYear, RepeaterSeason, RepeaterSeasonName, RepeaterMonth, RepeaterMonthName, RepeaterFortnight, RepeaterWeek].include?(repeater.class)
+          # when [RepeaterYear, RepeaterSeason, RepeaterSeasonName, RepeaterMonth, RepeaterMonthName, RepeaterWeek].include?(repeater.class)
           #   self.parse("this hour", :guess => false, :now => @now)
           # when [RepeaterWeekend, RepeaterDay, RepeaterDayName, RepeaterDayPortion, RepeaterHour].include?(repeater.class)
           #   self.parse("this minute", :guess => false, :now => @now)
index e6d5069..c4b1907 100644 (file)
@@ -42,7 +42,6 @@ class Horde_Date_Parser_Locale_Base_Repeater extends Horde_Date_Parser_Tag
         '/^years?$/' => 'year',
         '/^seasons?$/' => 'season',
         '/^months?$/' => 'month',
-        '/^fortnights?$/' => 'fortnight',
         '/^weeks?$/' => 'week',
         '/^weekends?$/' => 'weekend',
         '/^days?$/' => 'day',
diff --git a/framework/Date_Parser/lib/Horde/Date/Parser/Locale/Base/Repeater/Fortnight.php b/framework/Date_Parser/lib/Horde/Date/Parser/Locale/Base/Repeater/Fortnight.php
deleted file mode 100644 (file)
index 0460d75..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-class Horde_Date_Parser_Locale_Base_Repeater_Fortnight extends Horde_Date_Parser_Locale_Base_Repeater
-{
-  FORTNIGHT_SECONDS = 1_209_600 # (14 * 24 * 60 * 60)
-
-  def next(pointer)
-    super
-
-    if !@current_fortnight_start
-      case pointer
-      when :future
-        sunday_repeater = Chronic::RepeaterDayName.new(:sunday)
-        sunday_repeater.start = @now
-        next_sunday_span = sunday_repeater.next(:future)
-        @current_fortnight_start = next_sunday_span.begin
-      when :past
-        sunday_repeater = Chronic::RepeaterDayName.new(:sunday)
-        sunday_repeater.start = (@now + Chronic::RepeaterDay::DAY_SECONDS)
-        2.times { sunday_repeater.next(:past) }
-        last_sunday_span = sunday_repeater.next(:past)
-        @current_fortnight_start = last_sunday_span.begin
-      end
-    else
-      direction = pointer == :future ? 1 : -1
-      @current_fortnight_start += direction * FORTNIGHT_SECONDS
-    end
-
-    Chronic::Span.new(@current_fortnight_start, @current_fortnight_start + FORTNIGHT_SECONDS)
-  end
-
-  def this(pointer = :future)
-    super
-
-    pointer = :future if pointer == :none
-
-    case pointer
-    when :future
-      this_fortnight_start = Time.construct(@now.year, @now.month, @now.day, @now.hour) + Chronic::RepeaterHour::HOUR_SECONDS
-      sunday_repeater = Chronic::RepeaterDayName.new(:sunday)
-      sunday_repeater.start = @now
-      sunday_repeater.this(:future)
-      this_sunday_span = sunday_repeater.this(:future)
-      this_fortnight_end = this_sunday_span.begin
-      Chronic::Span.new(this_fortnight_start, this_fortnight_end)
-    when :past
-      this_fortnight_end = Time.construct(@now.year, @now.month, @now.day, @now.hour)
-      sunday_repeater = Chronic::RepeaterDayName.new(:sunday)
-      sunday_repeater.start = @now
-      last_sunday_span = sunday_repeater.next(:past)
-      this_fortnight_start = last_sunday_span.begin
-      Chronic::Span.new(this_fortnight_start, this_fortnight_end)
-    end
-  end
-
-  def offset(span, amount, pointer)
-    direction = pointer == :future ? 1 : -1
-    span + direction * amount * FORTNIGHT_SECONDS
-  end
-
-  def width
-    FORTNIGHT_SECONDS
-  end
-
-  def to_s
-    super << '-fortnight'
-  end
-end
\ No newline at end of file