metaregistrar / php-epp-client

Object-oriented PHP EPP Client
https://www.metaregistrar.com/docs/
MIT License
210 stars 153 forks source link

about default timezone #262

Closed jansen-s closed 4 years ago

jansen-s commented 4 years ago

I am in China now, and my time zone is UTC + 8, so the time stored in the program and database is UTC + 8. When I use this library, because the first line of autoloader.php sets the default time zone of the script to UTC will cause the time I passed in to be in UTC time zone. When the time returned from the registry is converted, it will also be converted in UTC time zone, which is wrong. I found that there is no function or method for time conversion in this library, so there is no need to specify the default time zone. Even if there is a time conversion in it, Datetime should be used to control the effective time zone range for this library.

metaregistrar commented 4 years ago

In dealing with the registries, we have found that keeping the timezone on UTC is the most useful, because the registry also has their logging on the UTC timezone. If there are questions about an EPP transaction, it is always best if timezones between the registry and the registrar match.

jansen-s commented 4 years ago

You are right, but the default time zone setting affects the entire script. We know that the library is loaded and the method in the library is not necessarily continuous. For example, in my code, the autoloader is loaded first, but then some local time calculation is performed, and then the library method is called. Finally process the response returned by the registry and convert the time to local time. Therefore, in order to make this library compatible with the local time habits of users in more countries, it is wise to remove the default time zone setting.