mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-06 01:08:50 +01:00
Update the date formatting syntax
This commit is contained in:
parent
3fc943ce2a
commit
13bdef74b3
14 changed files with 36 additions and 36 deletions
|
|
@ -110,7 +110,7 @@ class RecurringTodoTest < ActiveSupport::TestCase
|
|||
# every_day should return start_day if it is in the future
|
||||
@every_day.start_from = @in_three_days
|
||||
due_date = @every_day.get_due_date(nil)
|
||||
assert_equal @in_three_days.at_midnight.to_s(:db), due_date.to_s(:db)
|
||||
assert_equal @in_three_days.at_midnight.to_formatted_s(:db), due_date.to_formatted_s(:db)
|
||||
due_date = @every_day.get_due_date(@tomorrow)
|
||||
assert_equal @in_three_days.at_midnight, due_date
|
||||
|
||||
|
|
|
|||
|
|
@ -122,8 +122,8 @@ module RecurringTodos
|
|||
travel_to Time.zone.local(2013,1,1) do
|
||||
rt = create_recurring_todo
|
||||
assert_equal Time.zone.parse("2013-01-01 00:00:00"), rt.send(:determine_start, nil), "no previous date, use today"
|
||||
assert_equal Time.zone.parse("2013-01-01 00:00:00"), rt.send(:determine_start, nil, 1.day).to_s(:db), "no previous date, use today without offset"
|
||||
assert_equal Time.zone.parse("2013-01-02 00:00:00"), rt.send(:determine_start, Time.zone.now, 1.day).to_s(:db), "use previous date and offset"
|
||||
assert_equal Time.zone.parse("2013-01-01 00:00:00"), rt.send(:determine_start, nil, 1.day).to_formatted_s(:db), "no previous date, use today without offset"
|
||||
assert_equal Time.zone.parse("2013-01-02 00:00:00"), rt.send(:determine_start, Time.zone.now, 1.day).to_formatted_s(:db), "use previous date and offset"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -131,14 +131,14 @@ module RecurringTodos
|
|||
rt = create_recurring_todo
|
||||
|
||||
# march 2014 has 5 saturdays, the last will return the 5th
|
||||
assert_equal Time.zone.parse("2014-03-01 00:00:00"), rt.send(:get_xth_day_of_month, 1, 6, 3, 2014).to_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-22 00:00:00"), rt.send(:get_xth_day_of_month, 4, 6, 3, 2014).to_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-29 00:00:00"), rt.send(:get_xth_day_of_month, 5, 6, 3, 2014).to_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-01 00:00:00"), rt.send(:get_xth_day_of_month, 1, 6, 3, 2014).to_formatted_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-22 00:00:00"), rt.send(:get_xth_day_of_month, 4, 6, 3, 2014).to_formatted_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-29 00:00:00"), rt.send(:get_xth_day_of_month, 5, 6, 3, 2014).to_formatted_s(:db)
|
||||
|
||||
# march 2014 has 4 fridays, the last will return the 4th
|
||||
assert_equal Time.zone.parse("2014-03-07 00:00:00"), rt.send(:get_xth_day_of_month, 1, 5, 3, 2014).to_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-28 00:00:00"), rt.send(:get_xth_day_of_month, 4, 5, 3, 2014).to_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-28 00:00:00"), rt.send(:get_xth_day_of_month, 5, 5, 3, 2014).to_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-07 00:00:00"), rt.send(:get_xth_day_of_month, 1, 5, 3, 2014).to_formatted_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-28 00:00:00"), rt.send(:get_xth_day_of_month, 4, 5, 3, 2014).to_formatted_s(:db)
|
||||
assert_equal Time.zone.parse("2014-03-28 00:00:00"), rt.send(:get_xth_day_of_month, 5, 5, 3, 2014).to_formatted_s(:db)
|
||||
|
||||
assert_raise(RuntimeError, "should check on valid weekdays"){ rt.send(:get_xth_day_of_month, 5, 9, 3, 2014) }
|
||||
assert_raise(RuntimeError, "should check on valid count x"){ rt.send(:get_xth_day_of_month, 6, 5, 3, 2014) }
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class TodoTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def next_week
|
||||
1.week.from_now.beginning_of_day.to_s(:db)
|
||||
1.week.from_now.beginning_of_day.to_formatted_s(:db)
|
||||
end
|
||||
|
||||
# Test loading a todo item
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue