pavkam / tzdb

Delphi/FPC Time Zone Database
https://www.iana.org/time-zones
BSD 3-Clause "New" or "Revised" License
84 stars 27 forks source link

Footnotes on 2019b addition of "Fri<=1" Rule #12

Closed Pamoho closed 5 years ago

Pamoho commented 5 years ago

TZdb.pas Extract.txt My last word on this - promise!

My speculation that the new Rule should be "Fri<=29" with Mar (rather than Apr) has been knocked out. IANA 2019b is correct according to Knesset documents.**

But as TZdb can now handle rules like the one I proposed, I thought I should test the code against this (we only tested "Fri<=1" with Apr the other day).

I editted Asia file, and changed the line thusly: ### pmh Rule Zion 2005 2012 - Apr Fri<=1 2:00 1:00 D Rule Zion 2005 2012 - Mar Fri<=29 2:00 1:00 D

I recompiled with TZcompile, and tested with TZvisualizer.

For the years the rule affects I got these Start DST dates: Friday, 4 March 2005 Friday, 3 March 2006 Friday, 2 March 2007 Friday, 7 March 2008 Friday, 6 March 2009 Friday, 5 March 2010 Friday, 4 March 2011 Friday, 2 March 2012

A bit of digging around showed me that the compiler had correctly created the entries in TZdb.inc, but that it was the new function in TZdb.pas (EncodeDateMonthFirstDayOfWeekBefore) that was not working for the larger numbers.

I amended TZdb.pas (extract attached) and retested: Friday, 25 March 2005 Friday, 24 March 2006 Friday, 23 March 2007 Friday, 28 March 2008 Friday, 27 March 2009 Friday, 26 March 2010 Friday, 25 March 2011 Friday, 23 March 2012

These dates conform to the rule (dd is <= 29, mm is March and weekday is Fri). The changed code was regression tested for rule "Fri<=1 Apr" and produced results the same as the original.

Should I "pull" the source and apply my version of the function?

Cheers, Paul

** I got a very frosty, unhelpful response from IANA. Apparently I contacted the wrong person. While I was hunting around for an alternative place to pose my question, I came across another source (TimeAndDate.com) that confirmed all the original dates for Start of DST from 2005-12.

Turns out Wikipedia is wrong. But getting that corrected is a battle I don't want to front up for!

pmh

pavkam commented 5 years ago

Hi Paul, Thanks for that.

You are correct, the code I put in is incorrect. I would appreciate it if you submitted pull request and a test if you can.

Regarding the TZ in question - you are a better person than I am :) I cannot deal with "time nerds".

Thanks a mil - Alex.

Pamoho commented 5 years ago

Pulled - changed - testing completed and, aaargh!

Push is getting rejected. Tried a few options, but got nowhere. I'll try something else tomorrow morning (with fresh eyes).

Cheers, Paul! Screenshot 2019-07-10 20 14 22

pavkam commented 5 years ago

I think you are trying to push into my repository directly. You do not have the rights to do it.

The procedure in GitHub is as follows:

  1. Fork my repository into your account. (You can find the option once you view tzdb repo).
  2. Clone your repo.
  3. Add your changes and push to your repo.
  4. Create a Pull Request for your repo back to my repo.
  5. The owner of the main repo (me) will check the DIFF and apply or reject your PR, or comment. So if there's a bug or some non-conforming code you can fix it in your repo.

Once you do it once it becomes like second nature.

Pamoho commented 5 years ago

[Seriously, I need a holiday! Those beaches in Far North Queensland are calling!]

Your patient coaching paid dividends. See the "merge request" for TZdb.pas as per agreed actions.

Cheers, Paul

pavkam commented 5 years ago

Thanks Paul,

I will give it a look. In the mean time get a vacation (and don't get eaten by a koala! :)

Alex.

pavkam commented 5 years ago

Approved.

I will adjust the math from using subtraction to using IncDay/IncWeek function. That makes the code more readable as not everyone is aware of how date-time is represented.

Thanks a mil!

Pamoho commented 5 years ago

No worries - all good.

Consider this one closed :-)

Cheers, Paul