svendiedrichsen / jollyday

Jollyday - A holiday API
Other
191 stars 114 forks source link

RelativeToEasterSunday every not working #14

Closed pakmans closed 9 years ago

pakmans commented 9 years ago

I'm trying to define the thursday before easter sunday to be a holiday like this:

<tns:RelativeToEasterSunday every="EVERY_YEAR" localizedType="UNOFFICIAL_HOLIDAY" >
    <tns:chronology>JULIAN</tns:chronology>
    <tns:days>3</tns:days>
</tns:RelativeToEasterSunday>

With no luck. I have played with the values of the attributes without success. What am I missing?

svendiedrichsen commented 9 years ago

Unfortunately I don't see anything wrong. Besides maybe the missing property 'descriptionPropertiesKey' which is used when the clear name is to be read from the properties file. By the way:

The days should be -3 if you want it to be the day 3 days before easter sunday.

The JAXB/XSD is somewhat picky about the order in which the holidays appear within the configuration. Could you post the whole holiday configuration? I can check it if you like.

Cheers, Sven

pakmans commented 9 years ago

Thank you for your quick response. I tried you suggestion with same results. I created a simple test case: https://github.com/pakmans/jollydate-issue-example in case you have time to check it out. I'm using version 0.4.9, by the way.

svendiedrichsen commented 9 years ago

You are using the JULIAN chronology. Which means that you are actually referring to the 12th of april in 2015 as the easter sunday. When you subtract 3 days (by using -3) you end up with the 9th of april.

You should use GREGORIAN as your chronology. Then the test works fine.

<tns:RelativeToEasterSunday every="EVERY_YEAR" localizedType="UNOFFICIAL_HOLIDAY" descriptionPropertiesKey="GOOD_THURSDAY" >
    <tns:chronology>GREGORIAN</tns:chronology>
    <tns:days>-3</tns:days>
</tns:RelativeToEasterSunday>
pakmans commented 9 years ago

I had tried JULIAN and GREGORIAN, but I was using 3 instead of -3! It is working now, thank you for your generous help.

svendiedrichsen commented 9 years ago

anytime, you are welcome. you might want to star the project. ;)