Tagged Questions
-1
votes
1answer
22 views
Validate date/time in another country, prevent delay in timezones
How do I validate if the date of an object is going on today, preventing delay timezones.
My Ruby's app hosted in the USA and my time zone is in another country.
Ex:
List of games to be played ...
1
vote
1answer
40 views
How can I serialize Ruby's TZInfo data?
I have a Rails application that, like all Rails applications, uses Ruby's TZInfo library for time-zone information. This library uses Olson-style information, but it the implementation doesn't ...
4
votes
3answers
2k views
Ruby strptime with Timezone
I have a String which I parse with DateTime.strptime. The Timezone of the Date in the String is CET but Ruby creates an UTC DateTime Object which ofcourse has an offset of 2hrs.
currently im working ...
0
votes
1answer
35 views
Rails: Difference between timezones in hours
I'd like to be able to say user1 is 4 hours ahead of user2, calculated based on the time zones the users specify in their account.
Using the following code:
time1 = ...
0
votes
1answer
35 views
How to set app/server/Rack-wide timezone in Sinatra/Rack apps?
Is there a way to set the timezone for the entire Rack stack?
Ideally, I'd like one setting that can propagate to all middleware components, up to Sinatra, or whatever may be sitting on the front end ...
1
vote
3answers
1k views
Is Date.today in UTC?
Calling Date.today in Ruby returns the current date. However, what timezone is it in? I assume UTC, but I want to make sure. The documentation doesn't state either way.
0
votes
3answers
64 views
Ruby / Rails - How do i change the timezone of a Time, without changing the time
I have a record in the database which has :start_time and :timezone attributes.
The :start_time is a Time, with zone UTC - '2001-01-01 14:20:00', for example
The :timezone is a string - ...
1
vote
1answer
45 views
How can I convert a Time from some timezone to UTC, taking into account Daylight Saving, in Ruby?
I have an app where different users are in different parts of the globe (I know their timezone), and they can enter dates and times, and I need to store everything in UTC on the DB.
Normally to ...
8
votes
5answers
2k views
Ruby gem for finding timezone of location
I have a location (city, state), date, and time and I want to convert it to utc, but need to first find the timezone of the location. I've done a little research and everything seems to point to ...
2
votes
2answers
486 views
Easiest Way to Convert lat lng/zip/city/state to Timezone in Ruby
I'm interested in getting the timezone of my users. I already have their city, state, zip, lat & lng and I would like to get their timezone. I've one service that does this conversion ( ...
0
votes
1answer
51 views
ActiveSupport::TimeZone not recognized in Rspec tests
I am using ActiveSupport::TimeZone to set the time zone on a location based on the zip code.
def set_time_zone
self.time_zone = ActiveSupport::TimeZone.find_by_zipcode(self.zip)
end
This works ...
0
votes
1answer
47 views
Datetime from params not saved correctly in the database
I have the following situation . An user enters a date and time from rails's date and time select boxes and in the controller, method create, i have the following params:
"event"=>
...
3
votes
1answer
79 views
Time zone confusion (1 hour off)
Time.use_zone('Pacific Time (US & Canada)') do
p Time.zone.now
end
I get the following: => Sun, 14 Apr 2013 20:30:53 PDT -07:00
Yet when I do Rails Time Zone Select.... it ...
0
votes
1answer
53 views
ransack specify timezone in search query
I'm trying to find a way where i can tell ransack to use a specific timezone in queries that involve dates or date range. For example ransack by default uses UTC for datetime searches and i want to ...
0
votes
1answer
39 views
Rails, how to get hours of a datetime in the correct time zone?
I have an offer model. and when I access it from the command line, it is displayed in the following format:
1.9.3p392 :058 > o = Offer.last
=> #<Offer id: 15, title: "Testing", valid_from: ...