Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TZInfo::PeriodNotFound due to DST #96

williamdias opened this Issue Oct 20, 2018 · 1 comment


None yet
2 participants
Copy link

williamdias commented Oct 20, 2018


I'am getting TZInfo::PeriodNotFound due to DST in production environment. In development, it automatically goes to the next valid hour. This only occurs when submitting a form with a date field. Setting the date directly on rails console works as expected. Should I look for any specific configuration / env var in order to have the same behaviour on both environments? I am using Rails 5.1.3 and tzinfo 1.2.3.



This comment has been minimized.

Copy link

philr commented Oct 20, 2018

PeriodNotFound is raised by TZInfo if the local time you're specifying doesn't exist, typically because the clocks have been put forward an hour at the start of DST. TZInfo doesn't automatically skip to the next valid hour in such circumstances. Rails' ActiveSupport does, but this behaviour doesn't depend on any configuration or environment variables.

I would expect that you'd see the same behaviour with the Rails console as you would with the form submission. Trying to work out what the difference is and replicating in the console in production would probably be helpful.

Are you using the same data source and version of the Time Zone Database in development and production? You can check the selected data source with TZInfo::DataSource.get.

RubyDataSource reads data from the tzinfo-data gem - check that you're using the same version in each environment.

ZoneinfoDataSource uses zoneinfo files from your system - check that you have the same 'tzdata' (or similar) package version in each environment. Your application will need to be restarted if you upgrade the zoneinfo files in order to clear TZInfo's cache of data. If you are using different operating systems for development and production you may be better off switching to RubyDataSource (by adding tzinfo-data to your Gemfile) or compiling your own zoneinfo files.

@philr philr added the question label Oct 20, 2018

@philr philr closed this Nov 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.