I have been trying to get Swift on Linux use the most recent version of tzdata, but so far did not find any way to do so.
When using swift:5.9-jammy, this will have
apt list --installed | grep tzdata tzdata/now 2023c-0ubuntu0.22.04.2 all
TimeZone.timeZoneDataVersion from Swift it will tell us it has Version 2019c
import Foundation print(TimeZone.timeZoneDataVersion) // "2019c"
Updating the system tzdata, does not solve any issues, but will eventually create even more problems, e.g. executing
wget http://archive.ubuntu.com/ubuntu/pool/main/t/tzdata/tzdata_2023c-9ubuntu1_all.deb && sudo dpkg -i tzdata_2023c-9ubuntu1_all.deb && rm tzdata_2023c-9ubuntu1_all.deb will remove a symlink from
/usr/share/zoneinfo/Europe/Kyiv. Therefore, after applying this
TimeZone(identifier: "Europe/Kiev") and
TimeZone(identifier: "Europe/Kyiv") will return nil, while
TimeZone(identifier: "Europe/Kiev") was returning something valid before.
I understand that internally Swift Foundation uses ICU to query this data. However, I still don't fully understand when it depends on the system tzdata installation (obviously it somehow depends on it, because updating this data leads to changes) and when on the tzdata version that was used when building and linking against ICU.
Moreover, is there any way to update the time
TimeZone.timeZoneDataVersion without recompiling Swift from scratch?