aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/values/time_zone.rb
Commit message (Collapse)AuthorAgeFilesLines
* Improve ActiveSupport::TimeWithZone conversion to YAMLAndrew White2015-04-221-0/+9
| | | | | | | | | | | Previously when converting AS::TimeWithZone to YAML it would be output as a UTC timestamp. Whilst this preserves the time information accurately it loses the timezone information. This commit changes that so that it is saved along with the time information. It also provides nicer encoding of AS::TimeZone instances themselves which previously embedded all of the data from the TZInfo records. Fixes #9183.
* Refactor ActiveSupport::Timezone#strptimeAndrew White2015-04-221-28/+35
| | | | | Make strptime behave more like parse when components are missing and share behavior between the two methods.
* Add ActiveSupport::TimeZone#strptime.Paul A Jungwirth2015-04-221-0/+20
| | | | This makes it easier to parse user-inputted times as from a given time zone.
* Revert "Take DST into account when locating TimeZone from Numeric."Andrew White2015-03-091-7/+1
| | | | | | | | | | | | | | | | Reverting this as it's not the implementation that we would like it to be. This is being used inside of ActiveSUpport::TimeZone[] and it's unaware of the context in which to find the timezone period so the timezone found changes depending on whether DST is in effect for the current period. This means that `'2001-01-01'.in_time_zone(-9)` changes from winter/summer even though it's the same date that we're trying to convert. Since finding timezones by numeric offsets is a bit hit and miss we should introduce a new API for finding them which supplies the date context in which we want to search and we should probably also deprecate the finding of timezones via the [] method, though this needs further discussion. This reverts commit 2cc2fa3633edd96773023c6b09d07c7b9d9b841d.
* Take DST into account when locating TimeZone from Numeric.Yasyf Mohamedali2015-03-031-1/+7
| | | | | | When given a specific offset, use the first result found where the total current offset (including any periodic deviations such as DST) from UTC is equal.
* make zones_map privateTony Miller2015-02-061-7/+8
| | | | | Conflicts: activesupport/lib/active_support/values/time_zone.rb
* Add missing time zone definitions for Russian FederationAndrey Novikov2015-01-131-1/+4
| | | | Also sync Russian Federation time zones with `zone.tab` file from tzdata version 2014j.
* Use directly TZInfo::Timezone without proxybrainopia2015-01-041-2/+2
| | | | | Since real timezone is loaded anyway in `#utc_offset` which is called during `#create`
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-1/+1
|
* Change `gsub` to `tr` where possibleAlexander Balashov2014-10-061-1/+1
|
* reduce object allocations in utc_offsetAaron Patterson2014-08-291-2/+2
| | | | | | `try` allocates an array on every call, we should avoid calling it in hotspots. This reduced AttributeMethodsTest#test_setting_time_zone_aware_attribute_with_string from 18k allocations to 14k
* Collected TimeZone's class methods togetherprintercu2014-05-171-70/+69
| | | | Just moved class methods up in file and moved `def self.` methods into `class << self`.
* Tidy up implementation of #15010Andrew White2014-05-111-7/+1
|
* Make TimeZone#parse behave more like Time#parse.Ulysse Carion2014-05-111-1/+12
| | | | | Namely, if the mday is omitted but any other upper components are, then instead of supplying the mday from the current time, it defaults to 1.
* make tests pass on Ruby 2.2Aaron Patterson2014-03-131-1/+1
| | | | | | Apparently we've been using a buggy feature for the past 6 years: https://bugs.ruby-lang.org/issues/9593
* Maintain current timezone when changing time during DST overlapAndrew White2014-01-261-0/+4
| | | | | | | | | | | | | | Currently if a time is changed during DST overlap in the autumn then the method `period_for_local` will return the DST period. However if the original time is not DST then this can be surprising and is not what is generally wanted. This commit changes that behavior to maintain the current period if it's in the list of periods returned by `periods_for_local`. It is possible to alter the behavior of `period_for_local` by specifying a second argument but since we may be change from another time that could be either DST or not then this would give inconsistent results. Fixes #12163.
* Check `respond_to` before delegation due to: ↵Aaron Patterson2014-01-091-0/+1
| | | | https://github.com/ruby/ruby/commit/d781caaf313b8649948c107bba277e5ad7307314
* Don't lazy load the tzinfo libraryAndrew White2014-01-011-19/+2
| | | | | | | | | Lazy loading the tzinfo library doesn't really buy us anything because the gem is installed as a dependency via the gemspec and if a developer is using Active Support outside of Rails then they can cherry pick which files to load anyway. Fixes #13553
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2013-12-201-2/+2
|\
| * Typos. return -> returns. [ci skip]Lauro Caetano2013-12-031-2/+2
| |
* | Add support for localized date referencesColin Bartlett2013-12-031-0/+10
| | | | | | | | | | | | | | Ruby's Date class automatically gives us #yesterday, #today, and #tomorrow. And ActiveSupport has a handy Time.zone.today for getting a localized version. But there was no localized version of #yesterday or #tomorrow. Until now.
* | Remove AS::TZ.lookup(name).thedarkone2013-08-071-5/+1
| | | | | | | | The method doesn't really make much sense (find_tzinfo will succeed for any imput provided).
* | Unify AS::TZ's lazy init maps.thedarkone2013-08-071-9/+5
| | | | | | | | There's no point in having 2 almost identical (@lazy_zones_map and @zones_map) lazy initialized TZ instance caches.
* | Use TS::Cache instead plain Hash in TimeZone.thedarkone2013-08-071-5/+7
|/ | | | Plain ruby Hashes are not thread safe.
* Add Chatham Islands Time (UTC+1245) support.Hiro Asari2013-04-121-1/+2
| | | | Also update the documentation on the number of supported time zones.
* Fixed timezone mapping of Ulaanbaatar.Zolzaya2013-03-271-1/+1
|
* Remove manual "return true" from AS::TZ match methodCarlos Antonio da Silva2013-03-121-1/+1
|
* included "Montevideo" in list of time zone aliases (closes Issue #9628)Gernot2013-03-091-0/+1
|
* Deprecate obsolete Time to DateTime fallback methodsAndrew White2012-12-111-1/+1
| | | | | | | 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.
* Replace comments' non-breaking spaces with spacesclaudiob2012-12-041-1/+1
| | | | | | | | | | Sometimes, on Mac OS X, programmers accidentally press Option+Space rather than just Space and don’t see the difference. The problem is that Option+Space writes a non-breaking space (0XA0) rather than a normal space (0x20). This commit removes all the non-breaking spaces inadvertently introduced in the comments of the code.
* Only take the date parts from Time.zone.nowAndrew White2012-12-011-3/+3
| | | | | | | When there are missing components in the Hash returned by Date._parse only the date components should default to the value of Time.zone.now, the time components should all default to zero.
* Make `Time.zone.parse` to work with JavaScript date stringsAndrew White2012-12-011-11/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Chrome, Safari and Firefox serialize Date objects to strings such as 'Mon May 28 2012 00:00:00 GMT-0700 (PDT)'. When these strings are parsed the zone is interpreted as 'GMT-0700' which doesn't exist in the TzInfo list of timezones. By taking advantage of the improved date/time handling in 1.9.3 we can use `Date._parse` and the `:offset` value which is parsed correctly. Three tests were amended to make them pass: 1. test_parse_with_old_date This needed changing to a different value because the original value was before EST was adopted so was being changed to a LMT (Local Mean Time) value after the change. It didn't before because `DateTime` just has offsets from UTC not timezones. 2. test_parse_should_not_black_out_system_timezone_dst_jump Changed the implementation of this test as the stubs were dependent on internal implementation details of the test. Confirmed that the modified test still failed when the implementation of `parse` was restored to pre-#5571. 3. test_parse_should_black_out_app_timezone_dst_jump Ditto. Closes #5770.
* Fixed timezone mapping of Solomon Islands.Steve Klabnik2012-11-011-1/+1
| | | | | | | | Fixes #8095. For reference, here is the discussion about the mapping being incorrect: http://rubyforge.org/pipermail/tzinfo-users/2012-November/000114.html
* update AS/values and AS/xml_mini docs [ci skip]Francesco Rodriguez2012-09-141-36/+51
|
* Remove rescue clause from ActiveSupport::TimeZone#to_fAndrew White2012-07-011-2/+1
| | | | | Time#at no longer raises an error for large values so we can remove the rescue clause from ActiveSupport::TimeZone#to_f.
* Merge pull request #5571 from jarkko/5559-fix-dst-jump-bug-on-masterAaron Patterson2012-05-151-0/+5
|\ | | | | [#5559] Do not black out the system timezone DST jump hour if Time.zone ...
| * [#5559] Do not black out the system timezone DST jump hour if Time.zone ↵Jarkko Laine2012-03-241-0/+5
| | | | | | | | | | | | | | | | differs from that. The system timezone DST jump hour should not be blacked out by Time.zone.parse if current Time.zone does not do the jump at that time. Fixes #5559.
* | removing unnecessary 'examples' noise from activesupportFrancesco Rodriguez2012-05-131-5/+5
| |
* | more edits [ci skip]Vijay Dev2012-05-011-1/+1
| |
* | Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-05-011-0/+1
|\ \
| * | Add documention for utc_offset methodRob Zolkos2012-05-011-0/+1
| |/
* / Correcting some confusion. Pago Pago is part of American Samoa, not Samoa. ↵Dave Gerton2012-04-131-2/+4
|/ | | | Further, Samoa and Tokelau jumped across the IDL from Dec 29 to Dec 31, 2011 switching from UTC-11 to UTC+13. American Samoa did not make the change and remains at UTC-11. Pacific/Fakaofo and Pacific/Apia are in TZInfo and documentation about the dateline change is in austalasia at IANA.
* use empty? on the hash to avoid another method callAaron Patterson2012-03-161-1/+1
|
* removed unnecessary calls to "freeze"Aaron Patterson2012-03-161-2/+1
|
* make stubbing Time.now easierAaron Patterson2012-03-161-1/+7
|
* Clean up module docs [ci skip]Vijay Dev2012-03-071-21/+21
| | | | Removed some useless docstrings and no-doc'ed some.
* Make sure require_tzinfo only calls Kernel#require if TZInfo isn't already ↵Tim Lucas2011-09-071-1/+1
| | | | | | | | present. This wasn't a problem when require_tzinfo was only called from TimeZone#initialize, but now it's being called for every lookup to TimeZone.[] (via lazy_zones_map) TimeZone lookup can occur when unmarshalling TimeWithZone objects, which is where I first saw the big slowdown (500ms for each Rails action that loaded from Rails.cache)
* Fix tzinfo require (it broke ↵Jon Leighton2011-08-161-6/+13
| | | | test_raises_when_an_invalid_timezone_is_defined_in_the_config in railties)
* Be more lazy about creating time zone objects. Decreases startup time by ↵Jon Leighton2011-08-161-2/+13
| | | | about 10%. (#734)
* remove require active_support/tzinfo as file dosent exists #TODO fixVishnu Atrai2011-05-221-3/+1
|