-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
And its behavior is different from CRuby.
Environment
On Mac OS X, using System Preference.app, I set system timezone to JST (+0900).
Actual Behavior
JRuby 9.0.5.0:
irb(main):003:0> require 'time'
=> true
irb(main):002:0> Time.strptime('2016-08-01 00:00:00 PDT', '%Y-%m-%d %H:%M:%S %Z').strftime('%Y-%m-%d %H:%M:%S %Z')
=> "2016-08-01 00:00:00 UTC+7"
irb(main):003:0> Time.strptime('2016-08-01 00:00:00 UTC+7', '%Y-%m-%d %H:%M:%S %Z').strftime('%Y-%m-%d %H:%M:%S %Z')
=> "2016-08-01 00:00:00 JST"
irb(main):004:0> Time.strptime('2016-08-01 00:00:00 UTC+7', '%Y-%m-%d %H:%M:%S %z').strftime('%Y-%m-%d %H:%M:%S %Z')
=> "2016-08-01 00:00:00 JST"
JRuby's strftime with %Z outputs UTC+7, and strptime doesn't understand it (with neither %z or %Z).
CRuby 2.3.0:
irb(main):028:0> require 'time'
=> false
irb(main):029:0> Time.strptime('2016-08-01 00:00:00 PDT', '%Y-%m-%d %H:%M:%S %Z').strftime('%Y-%m-%d %H:%M:%S %Z')
=> "2016-08-01 00:00:00 "
irb(main):030:0> Time.strptime('2016-08-01 00:00:00 UTC+7', '%Y-%m-%d %H:%M:%S %Z').strftime('%Y-%m-%d %H:%M:%S %Z')
=> "2016-08-01 00:00:00 JST"
irb(main):031:0> Time.strptime('2016-08-01 00:00:00 UTC+7', '%Y-%m-%d %H:%M:%S %z').strftime('%Y-%m-%d %H:%M:%S %Z')
=> "2016-08-01 00:00:00 JST"
CRuby's strftime with %Z outputs (one space), and of course,strptime doesn't understand it.
Expected Behavior
- a) JRuby 9.0.5.0 behaves exactly same with CRuby, or
- b) JRuby 9.0.5.0's
strptimecan parseUTC+7using%Z%(and improve CRuby as well), or - c) JRuby 9.0.5.0's
strftimeoutputsPDTor+0700using%Z%(and improve CRuby as well)
Although it's behavior is different from CRuby, JRuby 9.0.5.0's improvement is good, I think. So, I prefer b) or c).
Reactions are currently unavailable