Skip to content

Conversation

@nobu
Copy link
Member

@nobu nobu commented Sep 30, 2020

Fix #25

@nobu nobu merged commit f08175e into ruby:master Oct 1, 2020
@ritikesh
Copy link

ritikesh commented Oct 1, 2020

Hey @nobu / @jeremyevans, thanks for fixing this. Quick question, will this be back ported to currently supported versions of Ruby? What versions will it be available in?

@jeremyevans
Copy link
Contributor

I assume it will be available in Ruby 3. Note that in all supported versions of Ruby, date is a default gem, so after the next release of the date gem, you should be able to gem install date, then in your code use gem 'date' before require 'date', to use the gem version instead of the stdlib version.

@ritikesh
Copy link

ritikesh commented Oct 3, 2020

We run a rails app in production, and tried adding date gem before rails. Still the same incorrect timezone for CAT.

# Gemfile
source 'https://rubygems.org'

ruby '2.7.1'

gem 'date', git: 'https://github.com/ruby/date', branch: 'master'

gem 'rails', '~> 6.0.0'
....
2.7.1 :002 > DateTime.parse("2020-10-01 00:00:00 CAT")
 => Thu, 01 Oct 2020 00:00:00 -1000

@jeremyevans
Copy link
Contributor

That's a bundler issue I would guess (maybe bundler or the webserver loads date). I think to be sure the updated date library is used, checkout the date master branch, and use RUBYLIB=/path/to/date/lib in the environment when running your application.

@ritikesh
Copy link

ritikesh commented Oct 5, 2020

Tried with RUBYLIB, but it didn't help either:

# Gemfile
source 'https://rubygems.org'

ruby '2.7.1'

gem 'date', git: 'https://github.com/ruby/date', branch: 'master'

gem 'rails', '~> 6.0.0'
....
RUBYLIB='/Users/user/.rvm/gems/ruby-2.7.1@gemset/bundler/gems/date-f08175e34d60' bundle exec rails c
Running via Spring preloader in process 72907
Loading development environment (Rails 6.0.3.2)
2.7.1 :001 > DateTime.parse('2020-10-01 00:00:00 CAT')
 => Thu, 01 Oct 2020 00:00:00 -1000

Let me dig deeper, thank you for your time!

@jeremyevans
Copy link
Contributor

RUBYLIB in your example looks wrong. Do an actual checkout of the date repository, run rake compile in it, and set RUBYLIB=/path/to/date/lib (note the /lib at the end). Then try RUBYLIB=/path/to/date/lib ruby -r date -e "DateTime.parse('2020-10-01 00:00:00 CAT')" to see if it works.

@nobu nobu deleted the fix-update-abbr branch July 9, 2021 00:04
@geophilusd
Copy link

I tried this out in ruby version 3.0.2
Looks like these changes are not reflected.

require 'date'
3.0.2 :002 > DateTime.parse("2021-08-09 19:39:31 CAT")
 => #<DateTime: 2021-08-09T19:39:31-10:00 ((2459437j,20371s,0n),-36000s,2299161j)> 
3.0.2 :003 > DateTime.parse("2021-08-09 19:39:31 SST")
 => #<DateTime: 2021-08-09T19:39:31+02:00 ((2459436j,63571s,0n),+7200s,2299161j)> 

jeremyevans added a commit to jeremyevans/date that referenced this pull request Aug 10, 2021
@jeremyevans
Copy link
Contributor

It turns out these changes aren't even in the date master branch. It looks like we missed the regeneration of zonetab.h. I'll send a pull request for that.

@geophilusd
Copy link

Can we expect this to be fixed in the next ruby release?

@geophilusd
Copy link

@jeremyevans In which ruby version will this be fixed?

@jeremyevans
Copy link
Contributor

Ruby master branch has the fixed zonetab.h, so Ruby 3.1 will contain the fix.

dmikurube pushed a commit to embulk/embulk-util-rubytime that referenced this pull request Mar 28, 2023
These zonetab IDs are imcompatible from Ruby 3.1. See:

* #64
* ruby/date#25
* ruby/date#26
* ruby/date@f08175e

The zonetab-based timezone parsing is "deprecated" in embulk-util-rubytime,
then we do not catch up with the update of Ruby.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants