Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #9825 (closed enhancement: fixed)

Opened 9 months ago

Last modified 9 months ago

[PATCH] Time and DateTime #advance honors :hours, :minutes and :seconds options

Reported by: gbuesing Assigned to: danger
Priority: normal Milestone: 2.x
Component: ActiveSupport Version: edge
Severity: normal Keywords:
Cc:

Description

This patch adds :hours, :minutes and :seconds options to Time and DateTime #advance (currently, this method only supports :years, :months and :days options.)

Examples:

>> Time.utc(2007,10,8,9,32,15).advance(:hours => 2)
=> Mon Oct 08 11:32:15 UTC 2007

>> Time.utc(2007,12,8,9,32,15).advance(:months => 2, :minutes => 5)
=> Mon Dec 08 09:37:15 UTC 2007

Tests included. Based on an idea suggested by chuyeow in the comments of #9818.

Attachments

time_and_datetime_advance_honors_hours_minutes_seconds.diff (7.5 kB) - added by gbuesing on 10/13/07 19:28:44.
time_and_datetime_advance_honors_hours_minutes_seconds_from_root.diff (7.6 kB) - added by danger on 10/13/07 19:55:13.
same as first patch but created from root dir

Change History

10/13/07 19:28:44 changed by gbuesing

  • attachment time_and_datetime_advance_honors_hours_minutes_seconds.diff added.

10/13/07 19:55:13 changed by danger

  • attachment time_and_datetime_advance_honors_hours_minutes_seconds_from_root.diff added.

same as first patch but created from root dir

10/13/07 19:55:35 changed by danger

  • owner changed from core to danger.
  • status changed from new to assigned.

+1 Solid patch. Thanks for the extra tests.

10/13/07 21:45:02 changed by bitsweat

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [7866]) Time and DateTime#advance accept :hours, :minutes, and :seconds options. Closes #9825.