Openpyxl does not handle localized datetime correctly
*Created originally on Bitbucket by [sebdiem (Sébastien Diemer)](https://bitbucket.org/%7B766baa6a-afc5-4a39-aef1-f292f8ae6838%7D/)* Openpyxl does not handle localized datetime correctly. Depending on the order of the calls to `openpyxl.utils.datetime.to_excel`, the user might get different results. This is caused by the `@lru_cache` decorator used by the `to_excel` function. When called with the same datetime, localized with different timezones, the cache considers both objects equal (since they effectively are in python). Here is a script reproducing the bug: ``` #!python import datetime import pytz from openpyxl.utils.datetime import to_excel date_utc = pytz.utc.localize(datetime.datetime(2015, 7, 24)) date_paris = date_utc.astimezone(pytz.timezone('Europe/Paris')) print 'Paris', to_excel(date_paris) print 'UTC', to_excel(date_utc) >>> Paris 42209.0833333 >>> UTC 42209.0833333 ``` If a rerun the script, inverting the last two lines I get the following output: ``` #!python >>> UTC 42209.0 >>> Paris 42209.0 ```
issue