After updating my MacOS to the latest version, I had some strange problem with the Time # strftime method.
Time.now.in_time_zone("Kathmandu").strftime("%Z") #=> '+0545' Time.now.in_time_zone("Bangkok").strftime("%Z") #=> '+07' Time.now.in_time_zone("Nairobi").strftime("%Z") #=> 'EAT' Time.now.in_time_zone("New Delhi").strftime("%Z") #=> 'IST'
My current version of ruby:
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
I tried:
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin16]
and still not working
I tried this on my machine for a friend (ruby 2.4.1p111 (version 2017-03-22 version 58053) [x86_64-darwin15]) and its work is excellent.
Time.now.in_time_zone("Kathmandu").strftime("%Z") #=> 'NPT' Time.now.in_time_zone("Bangkok").strftime("%Z") #=> 'ICT' Time.now.in_time_zone("Nairobi").strftime("%Z") #=> 'EAT' Time.now.in_time_zone("New Delhi").strftime("%Z") #=> 'IST'
ruby ruby-on-rails macos
Susan joshi
source share