| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
This prevents duplication of code.
Prevent duplication of tests by moving them to `DateAndTimeBehavior`.
Related to #32185.
|
|
|
|
|
|
|
|
| |
Equality comparisons between dates and times can take some extra time to
comprehend. I tend to think of a date or time as "before" or "after"
another date or time, but I naturally read `<` and `>` as "less than"
and "greater than." This change seeks to make date/time comparisons more
human readable.
|
|
|
|
| |
This basically reverts 8da30ad6be34339124ba4cb4e36aea260dda12bc
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Support `:offset` in `Time#change` and `:zone` or `:offset`
in `ActiveSupport::TimeWithZone#change`.
Fixes #28723.
|
|
|
|
|
|
|
| |
The `Time.xmlschema` and consequently its alias `iso8601` accepts
timestamps without a offset in contravention of the RFC 3339
standard. This method enforces that constraint and raises an
`ArgumentError` if it doesn't.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
|
|
|
|
|
| |
Useful for queries like:
Item.where(created_at: Date.current.all_day)
There was already a Time#all_day with the same behaviour, but for
queries like the above, Date is more convenient.
|
|
|
|
| |
Time instances can have fractional parts smaller than a nanosecond.
|
|
|
|
|
| |
Mirrors the DateTime#sec_fraction method by returning the fraction
of the second as a Rational.
|
| |
|
| |
|
|\
| |
| | |
[ci skip] Fix #seconds_since_midnight documentation output it will al…
|
| |
| |
| |
| | |
return floating pointnumber
|
|\ \
| | |
| | | |
Use #current instead of #now to prevent zone issues and use new ruby …
|
| |/
| |
| |
| | |
application's time zone
|
|/ |
|
|\
| |
| | |
Add require to ensure Time#advance works without implicit required
|
| |
| |
| |
| | |
required
|
|/ |
|
|
|
|
|
| |
Passing 999999000 < `:nsec` < 999999999 and 999999 < `:usec` < 1000000
to change a time with utc_offset doesn't throw an `ArgumentError`.
|
|
|
|
| |
core_ext/time"
|
| |
|
|
|
|
|
|
| |
In dev, ActiveSupport::FileUpdateChecker#max_mtime triggers many
time comparisons. Time#to_time is quite a bit slower than not doing it,
so we should avoid it if possible.
|
| |
|
| |
|
| |
|
|
|
|
| |
Closes #16392.
|
|
|
|
|
|
|
|
|
|
| |
https://github.com/rails/rails/commit/98b46bf5e201307cae56ee14bf41363a539779c5
did not properly handled out-of-range `:usec`s.
Passing a `:usec` that's out of range now throws an `ArgumentError` as it
should.
Fixes #16759.
|
|\
| |
| | |
Maintain proleptic gregorian in Time#advance
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Time#advance uses Time#to_date and Date#advance to calculate a new date.
The Date object returned by Time#to_date is constructed with the assumption
that the Time object represents a proleptic gregorian date, but it is
configured to observe the default julian calendar reform date (2299161j)
for purposes of calculating month, date and year:
Time.new(1582, 10, 4).to_date.to_s # => "1582-09-24"
Time.new(1582, 10, 4).to_date.gregorian.to_s # => "1582-10-04"
This patch ensures that when the intermediate Date object is advanced
to yield a new Date object, that the Time object for return is contructed
with a proleptic gregorian month, date and year.
|
| | |
|
|\ \
| | |
| | | |
Added Time#middle_of_day method
|
| |/
| |
| |
| | |
Added middle_of_day method to Date and DateTime
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The standard Ruby behavior for Time.at is to return the same type of
time when passing an instance of Time as a single argument. Since the
an ActiveSupport::TimeWithZone instance may be a different timezone than
the system timezone and DateTime just understands offsets the best we
can do is to return an instance of Time with the correct offset.
Fixes #11350.
|
| |
| |
| |
| |
| |
| |
| |
| | |
When Time.at_with_coercion (wraps Time.at) is called with a single
argument that "acts_like?(:time)" it is coerced to integer thus losing
it's microsecond percision.
This commits changes this to use `#to_f` to prevent the problem
|
| | |
|
| |
| |
| |
| | |
and `Time#local_time` in favour of `Time#utc` and `Time#local`
|
|/
|
|
|
|
|
| |
Time.at allows passing a single Time argument which is then converted
to an integer. The conversion code since 1.9.3r429 explicitly checks
for an instance of Time so we need to override it to allow DateTime
and ActiveSupport::TimeWithZone values.
|
| |
|
| |
|
|
|
|
|
|
|
| |
The Time.time_with_datetime_fallback, Time.utc_time and Time.local_time
methods were added to handle the limitations of Ruby's native Time
implementation. Those limitations no longer apply so we are deprecating
them in 4.0 and they will be removed in 4.1.
|
| |
|
| |
|