A Quick Introduction to WordPress’ Date/Time Component

At WordCamp Nordic’s contributor day I had the opportunity to chat with Andrey “Rarst” Savchenko about WordPress’ Date/Time component, the code that manages date, time, and timezone functionality. Savchenko is one of the maintainers of this lesser-known component, which includes code that dates back to PHP 4 times. After volunteering for years in the WordPress Stack Exchange forums, he encountered some of the worst Date/Time bugs, eventually spurring him on to get involved improving the code.
“From there it was a slow descent into the madness of the component,” Savchenko said. “Much of my experience ended up in my WpDateTime library. By last year I was, at last, confident I had a good grasp on the extent of the problem and a way forward for core.”
Date/Time issues affect both developers and users. Savchenko said most of the problems, by volume, are related to an incorrect output of localized time by `date_i18n()`. These things can trickle down to users and affect post scheduling, querying, and other operations.
“Some of them are outright bugs and some are easy to break due to incompatibility with Unix timestamps,” Savchenko said.  » Read More