Anvil Uplink 0.4.0: Datetime changes

Summary: We’ve fixed a bug in the Uplink that affects timezones for naive datetime objects sent from Uplink code. If you’re working around this behaviour already, you’ll need to take care when updating. Otherwise, this probably does not affect you.


Details:

Version 0.4.0 of the anvil-uplink library changes how it handles naive datetime objects (that is, datetimes without a timezone set) sent from Uplink code to server or client code. Previously, these objects were assumed to be in UTC, which is probably not where your server is running. This was confusing people! Now, naive datetime objects will be “stamped” with the timezone in which your Uplink code is executing (the same way things are handled in the client).

The upshot is that if you return datetime.now() from an Uplink function running in Paris, and compare it to a datetime.now() from client code running in New York, they will refer to the same instant in time! This is the correct behaviour, and the only reason I’m making an announcement post on the forum is that if you’ve previously worked around this problem, you might be surprised.

This will not affect applications that use previous versions of the Uplink – the change will only take effect when you upgrade your local Uplink library.

To upgrade, it’s the usual: pip install --upgrade anvil-uplink

(Also in this update: Accelerated Tables support!)

6 Likes