mardi 20 décembre 2016

How .to_day fixed my date issue

We have a build that runs all the ruby files including unit_tests. Build is configured at UTC time and our database inserts records based on CST timezone because config.time_zone property in application.rb is set to CST timezone.

My unit tests had start_date: 50.days.ago and when i ran build it'll pass anytime during day before 7 PM. After 7 PM per build UTC time its next day. I mean if i start build at 7:10PM, build will show 12:10 AM and it'll fail.

I changed start_date: 50.days.ago.to_date and it doesnt fail now. Can someone explain me why it worked using to_date?

Aucun commentaire:

Enregistrer un commentaire