RDT icon indicating copy to clipboard operation
RDT copied to clipboard

Make DatetimeTransformer timezone-aware

Open ManuelAlvarezC opened this issue 7 years ago • 2 comments

The current DatetimeTransformer is converting the datetime values to integer and back without considering the timezones.

The timezones could be added as a new column, either categorical, using the CategorialTransformer, in a fashion similar to how the NullTransformer is being used, or numerical.

ManuelAlvarezC avatar Oct 02 '18 17:10 ManuelAlvarezC

The DTTransformer has been replaced by the new DatetimeTransformer implemented in #101 so this issue is not precise anymore.

However, the new DatetimeTransformer is still unaware of timezones, so I'm changing the description of the issue to address this topic properly.

csala avatar Oct 15 '19 14:10 csala

Title and description have been changed. This are the old ones:

Make DTTransform use UTC

Currently, DTTransformer uses the time.localtime and time.mktime to transform datetime values to numeric and back.

The problem is that both of them work using as reference the local timezone. I propose instead using time.gmtime and [calendar.timegm]https://docs.python.org/3/library/calendar.html#calendar.timegm) that uses as reference UTC.

Also, delete the casting to float and multiplying for 10e9 if it's not really needed, because this way will avoid floating point rounding issues.

csala avatar Oct 15 '19 14:10 csala