Post

Today I learned that Date.to_datetime sets the time to midnight *in UTC*, not the current time zone. This can create subtle bugs or test flakiness if you’re using libraries like Faker that respect ENV[‘TZ’].

0 reposts0 likes

The *only* way this is slightly sensible — and even then — is there's an old legal definition of "the day" for contracts law, that if you only get told "the day", but for whatever reason you (really) need an epoch, then use midday that day — and if you need a timezone, then UTC But: 12:00 not 00:00