How frequently do I need to update the Noda Time timezone database, and what are the steps to automatically update it?
1 Answer
How frequently I need to update timezone database.
When it changes :)
You can find this out by fetching http://nodatime.org/tzdb/latest.txt which always contains the URL of the latest .nzd file.
Or if you don't need automation, subscribe to the [email protected]
mailing list (via the IANA time zone home page) - that contains an announcement for each release.
What are the steps to automatically update the timezone database.
Download the latest .nzd file, then create a TzdbDataSource
from it, as documented in the user guide:
IDateTimeZoneProvider provider;
using (var stream = File.OpenRead(...))
{
var source = TzdbDateTimeZoneSource.FromStream(stream);
provider = new DateTimeZoneCache(source);
}
That's assuming you're happy to wait for me to build the nzd file and upload it, of course. Alternatively, you can fetch the latest source code, build the NodaTime-All
solution and then run the NodaTime.TzdbCompiler
utility yourself. This is easier now than it used to be, as you can just specify a URL to the latest .tar.gz file and the directory containing the CLDR files.
There isn't a simple way of updating NodaTime.dll
itself to embed a new version of the tz database - basically it comes with whatever was current when it was built, and if you want something more recent you need to use the code above.