GithubHelp home page GithubHelp logo

jollyday's Introduction

Jollyday

Sonarcloud Bugs Build Status Coverage Status Maven Central

File encoding: Please use UTF-8 as your default file encoding. Code formatting: Please use the provided code-formatter.xml as your project code formatter.

0.4 Branch

To use latest release based on Joda-Time add this to your pom.xml:

<dependency>
    <groupId>de.jollyday</groupId>
    <artifactId>jollyday</artifactId>
    <version>0.4.9</version>
</dependency>

0.5 Branch

To use latest release based on Java Time API and Threeten-Extra library add this to your pom.xml:

<dependency>
    <groupId>de.jollyday</groupId>
    <artifactId>jollyday</artifactId>
    <version>0.5.8</version>
</dependency>

0.6 Branch planned

Planning to replace usage of JAXB with JiBX/XStream

License

Apache License, Version 2.0

jollyday's People

Contributors

axelsteffen avatar bartlaarhoven avatar cschneider avatar cwguenther avatar dertobsch avatar dusiema avatar dwuehrer avatar fanste avatar fkleon avatar focbenz avatar gebeater avatar gestern avatar ioana-andronescu avatar ivani3 avatar kattisa avatar liefke avatar mliberato avatar netskeh avatar oleksandrshkurat avatar opensource21 avatar peffenberger avatar philipp-borchert-ish avatar raider2000 avatar rototor avatar samymohammed avatar shobhitpuri avatar sjmisterm avatar svendiedrichsen avatar tenjaa avatar zugarelli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jollyday's Issues

Change german translation for Stephensday

In Germany, the 26th of December officially is called "Zweiter Weihnachtsfeiertag" instead of "Stephanstag". Although not formally wrong, this name is not used widely. Please change this translation.

Some questions. (want to contribute)

  1. Do you have some kind of gui calendar (web for example), backed by your library. It will make more simple to find errors in it
  2. Do you concentrate only in holidays that are non-working days?
  3. Does your application support short working days (non full working days)
  4. Does your application detect every week holidays (saturday + sunday - most of countries, only suturday + short working day at friday - israel)

I want to contribute to russia holidays

Correct Whitsun and Easter in Germany

In Germany, Whitsunday ("WHIT_SUNDAY") and Eastersunday ("EASTER") are no holidays by law, except in the state of Brandenburg ("bb"). Please correct this.

Too extensive permission required

We are using Jolliday in our current project. We are also required to run our application with the Java security manager enabled. That's why we ran into an unexpected AccessControlException because of Jolliday. Our customer demands to point out all permissions that are required by our application. Because of the security driven application management of our customer, we are not allowed to use wildcard permissions without effortful justifications.

Our problem is located in URLConfigurationProvider.getProperties().

@Override
public Properties getProperties() {
    Properties properties = new Properties();
    Properties systemProps = System.getProperties();
    String configURLs = systemProps.getProperty(CONFIG_URLS_PROPERTY);
    if (configURLs != null) {
        String[] strConfigURLs = configURLs.split(",");
        for (String strURL : strConfigURLs) {
            readPropertiesFromURL(properties, strURL);
        }
    }
    return properties;
}

Using System.getProperties() requires a java.util.PropertyPermission with a wildcard.

permission java.util.PropertyPermission "*", "read,write";

The point is, this is not necessary! The method URLConfigurationProvider.getProperties() is invoking System.getProperties() just to get the single property de.jollyday.config.urls out of that.

Instead of ...

...
Properties systemProps = System.getProperties();
String configURLs = systemProps.getProperty(CONFIG_URLS_PROPERTY);
...

... you can just do this ...

...
String configURLs = System.getProperty(CONFIG_URLS_PROPERTY);
...

The result would be exactly the same. You don't need the detour by using the result of System.getProperties(). You can read the required property directly. This would just require the permission to read(!) a property. We have that permission already. No discussion with our customer would be needed.

Since there is absolutely no way to override this method, because the URLConfigurationProvider is a private field in ConfigurationProviderManager and there is no way the set a different implementation of URLConfigurationProvider. And the ConfigurationProviderManager itself is a private and static field in HolidayManager. Simply put: There is no technical option to around that. Nothing but to fix this in the master code base or to create a fork.

Removing a parent holiday from a subconfiguration

Is there a way to define, in a subconfiguration, that an Holiday in the parent configuration shouldn't be an Holiday for this subconfiguration? For example, if you take the city of berkeley, in California USA, according to wikipedia (https://en.wikipedia.org/wiki/Public_holidays_in_the_United_States#Berkeley,_California) Cesar Chavez Day is not an Holiday whereas it is for the rest of the California state. But with the rules defined in the Holiday_us.xml file (https://github.com/svendiedrichsen/jollyday/blob/master/src/main/resources/holidays/Holidays_us.xml), Cesar Chavez Day would be defined as an Holiday in Berkeley as a subconfiguration inherit all the holidays from its parent configuration (and California has CESAR_CHAVEZ defined as an Holiday).

Allow build on and usage with OpenJDK 11

Building jollyday with OpenJDK 11 fails due to

[INFO] --- jaxb2-maven-plugin:2.4:xjc (generate) @ jollyday ---
[INFO] Created EpisodePath [/mnt/data/home/software/jollyday/target/generated-sources/jaxb/META-INF/JAXB]: true
[INFO] Ignored given or default xjbSources [/mnt/data/home/software/jollyday/src/main/xjb], since it is not an existent file or directory.
[INFO] Created EpisodePath [/mnt/data/home/software/jollyday/target/generated-sources/jaxb/META-INF/JAXB]: true
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.058 s
[INFO] Finished at: 2019-01-09T21:29:49+01:00
[INFO] ------------------------------------------------------------------------
---------------------------------------------------
constituent[0]: file:/usr/share/maven/conf/logging/
constituent[1]: file:/usr/share/maven/lib/aopalliance.jar
constituent[2]: file:/usr/share/maven/lib/cdi-api.jar
constituent[3]: file:/usr/share/maven/lib/commons-cli.jar
constituent[4]: file:/usr/share/maven/lib/commons-io.jar
constituent[5]: file:/usr/share/maven/lib/commons-lang3.jar
constituent[6]: file:/usr/share/maven/lib/guava.jar
constituent[7]: file:/usr/share/maven/lib/guice.jar
constituent[8]: file:/usr/share/maven/lib/jansi.jar
constituent[9]: file:/usr/share/maven/lib/javax.inject.jar
constituent[10]: file:/usr/share/maven/lib/jcl-over-slf4j.jar
constituent[11]: file:/usr/share/maven/lib/jsr250-api.jar
constituent[12]: file:/usr/share/maven/lib/maven-artifact-3.x.jar
constituent[13]: file:/usr/share/maven/lib/maven-builder-support-3.x.jar
constituent[14]: file:/usr/share/maven/lib/maven-compat-3.x.jar
constituent[15]: file:/usr/share/maven/lib/maven-core-3.x.jar
constituent[16]: file:/usr/share/maven/lib/maven-embedder-3.x.jar
constituent[17]: file:/usr/share/maven/lib/maven-model-3.x.jar
constituent[18]: file:/usr/share/maven/lib/maven-model-builder-3.x.jar
constituent[19]: file:/usr/share/maven/lib/maven-plugin-api-3.x.jar
constituent[20]: file:/usr/share/maven/lib/maven-repository-metadata-3.x.jar
constituent[21]: file:/usr/share/maven/lib/maven-resolver-api.jar
constituent[22]: file:/usr/share/maven/lib/maven-resolver-connector-basic.jar
constituent[23]: file:/usr/share/maven/lib/maven-resolver-impl.jar
constituent[24]: file:/usr/share/maven/lib/maven-resolver-provider-3.x.jar
constituent[25]: file:/usr/share/maven/lib/maven-resolver-spi.jar
constituent[26]: file:/usr/share/maven/lib/maven-resolver-transport-wagon.jar
constituent[27]: file:/usr/share/maven/lib/maven-resolver-util.jar
constituent[28]: file:/usr/share/maven/lib/maven-settings-3.x.jar
constituent[29]: file:/usr/share/maven/lib/maven-settings-builder-3.x.jar
constituent[30]: file:/usr/share/maven/lib/maven-shared-utils.jar
constituent[31]: file:/usr/share/maven/lib/maven-slf4j-provider-3.x.jar
constituent[32]: file:/usr/share/maven/lib/plexus-cipher.jar
constituent[33]: file:/usr/share/maven/lib/plexus-component-annotations.jar
constituent[34]: file:/usr/share/maven/lib/plexus-interpolation.jar
constituent[35]: file:/usr/share/maven/lib/plexus-sec-dispatcher.jar
constituent[36]: file:/usr/share/maven/lib/plexus-utils.jar
constituent[37]: file:/usr/share/maven/lib/sisu-inject.jar
constituent[38]: file:/usr/share/maven/lib/sisu-plexus.jar
constituent[39]: file:/usr/share/maven/lib/slf4j-api.jar
constituent[40]: file:/usr/share/maven/lib/wagon-file.jar
constituent[41]: file:/usr/share/maven/lib/wagon-http-shaded.jar
constituent[42]: file:/usr/share/maven/lib/wagon-provider-api.jar
---------------------------------------------------
Exception in thread "main" java.lang.Error: java.lang.reflect.InvocationTargetException
	at com.sun.tools.xjc.reader.Ring.get(Ring.java:113)
	at com.sun.tools.xjc.reader.xmlschema.BGMBuilder.<init>(BGMBuilder.java:147)
	at com.sun.tools.xjc.reader.xmlschema.BGMBuilder.build(BGMBuilder.java:117)
	at com.sun.tools.xjc.ModelLoader.annotateXMLSchema(ModelLoader.java:407)
	at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:162)
	at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:117)
	at com.sun.tools.xjc.Driver.run(Driver.java:354)
	at org.codehaus.mojo.jaxb2.javageneration.AbstractJavaGeneratorMojo.performExecution(AbstractJavaGeneratorMojo.java:468)
	at org.codehaus.mojo.jaxb2.AbstractJaxbMojo.execute(AbstractJaxbMojo.java:315)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:954)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at com.sun.tools.xjc.reader.Ring.get(Ring.java:102)
	... 30 more
Caused by: java.lang.Error: java.lang.reflect.InvocationTargetException
	at com.sun.tools.xjc.reader.Ring.get(Ring.java:113)
	at com.sun.tools.xjc.reader.xmlschema.BindingComponent.getClassSelector(BindingComponent.java:65)
	at com.sun.tools.xjc.reader.xmlschema.ColorBinder.<init>(ColorBinder.java:62)
	at com.sun.tools.xjc.reader.xmlschema.BindGreen.<init>(BindGreen.java:63)
	... 35 more
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at com.sun.tools.xjc.reader.Ring.get(Ring.java:102)
	... 38 more
Caused by: java.lang.NoClassDefFoundError: javax/activation/MimeTypeParseException
	at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3138)
	at java.base/java.lang.Class.getConstructor0(Class.java:3343)
	at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2554)
	at com.sun.tools.xjc.reader.Ring.get(Ring.java:100)
	at com.sun.tools.xjc.reader.xmlschema.DefaultClassBinder.<init>(DefaultClassBinder.java:98)
	at com.sun.tools.xjc.reader.xmlschema.ClassSelector.<init>(ClassSelector.java:214)
	... 43 more
Caused by: java.lang.ClassNotFoundException: javax.activation.MimeTypeParseException
	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
	... 50 more

experienced with v_0_5_7-12-ge359ee2

Netherlands changes Queens day to King's day

Hi,
I noticed that the NL holiday file contains Queensday. As of 2014, we will celebrate King's day. This is on the 26th of april.
So:
Fixed month="APRIL" day="30" descriptionPropertiesKey="QUEENS_BIRTHDAY"
Should be changed to
Fixed month="APRIL" day="26" descriptionPropertiesKey="KINGS_BIRTHDAY"
Thanks,
Arjan Lamers

How to check for regional holidays?

As of now, I'm using the latest version (0.5.2).

Consider the following method which checks if the given date is a holiday:

public boolean isBankHoliday(Date d) {
    Calendar c = new GregorianCalendar();
    c.setTime(d);
    URL url = getClass().getResource("/holidays/Holidays_de.xml");
    UrlManagerParameter urlManParam = new UrlManagerParameter(url, new Properties());
    HolidayManager holidayManager = HolidayManager.getInstance(urlManParam);

    boolean isHoliday = holidayManager.isHoliday(c, "de", "he");
    boolean isHolidayBundesland = holidayManager.isHoliday(c, "country.description.de.he");
    if (isHoliday || isHolidayBundesland) {
        return true;
    } else {
        return false;
    }
}

public static void main(){
    scanner = new Scanner(System.in);
    System.out.println("Enter the folder name: ");
    String input = scanner.next();
    DateFormat format = new SimpleDateFormat("dd-MM-yyyy");
    Date date = format.parse(input);
    System.out.println(app.isBankHoliday(date));
}

The method is working fine for national-wide holidays (like New Year's etc.).
However, if I try to check for holidays for let's say "Hessen" ("he"), then it seems to not working.
I use the provided XML file and for "Hessen", there is an entry for the Christian holiday "CORPUS CHRISTI" which is the 31st May in 2018.

<tns:SubConfigurations hierarchy="he" description="Hesse">
  	<tns:Holidays>
  		<tns:ChristianHoliday type="CORPUS_CHRISTI" />
  	</tns:Holidays>
</tns:SubConfigurations>

It returns false.
Is .isHoliday(c, "de", "he") the correct usage here? How is the correct usage?

I appreciate every answer. Thank you.

Chinese Holiday

Is there a chance to get a chinese holiday XML file? Is the library even prepared to calculate those holidays?

Thanks.

Custom Holidays

Hi,
I am able to load my custom holidays, but it's not able to read the decription as the corresponding keys don't exist in holiday_descriptions.properties. I've provided the key in my custom properties but that doesn't seem to work either

  def getConfig(): HolidayManager = {
    val urlOpt = Some(getClass.getClassLoader.getResource("holidays.xml"))
    urlOpt match {
      case Some(url : URL) =>
        val props = new Properties()
        props.put("holiday.description.OATH_BIRTHDAY", "oath birthday")
        val urlManParam = new UrlManagerParameter(url, props)
        HolidayManager.getInstance(urlManParam)
      case _ =>
        HolidayManager.getInstance()
    }

Where is the package "de.jollyday.config" on GitHub?

Some classes like EthiopianOrthodoxHolidayParser refer to the package (for example to the class de.jollyday.config.Holidays) but I cannot find the package - neither on GitHub nor on downloaded zip-files from GitHub. I think, an open-source-project is supposed to contain all source code, or have I overlooked something?

Background is, I would like to contribute for example Hebrew holidays in the future but then I need to see and understand the whole source code...

New German Holidays

These days in Hamburg and Schleswig-Holstein there was a decision that the 31.10. will be a holiday named "Tag der Reformation" (beginning from 2018!). In Niedersachsen (lower saxony) there are similar plans but the final decisions isn't finished.

Multiple HolidayManager objects using different Holiday sources

Hey,

I was wondering if it is possible to have 2 (or more) different HolidayManagers objects. So far I only found the HolidayManager#getInstance(...), which heavily suggests it works as a Singleton.
My use-case involves taking care of Holidays of different countries (or states depending of the specific country)
Did I miss anything or is jollyday not ready for that just yet?

If multiple objects are not possible, how could I safely change the configuration to do my operations in a sequential fashion?

Jollyday failing in OSGI-Environments with a 1.8 JRE

We use jollyday 0.5.4 in our Apache-Camel Routes on an Apache Servicemix/Karaf, this requires threeten-extra 1.3.2, which is supposed to run with a 1.8 JRE, but wrongly declares a dependency on Java-1.9 in its OSGI headers.

ThreeTen/threeten-extra#97

This bug has been fixed in Threeten-Extra 1.3.2, but a modified version has not been released yet.

A jollyday release with an updated version of threeten-extra would fix this issue.

java.lang.IllegalStateException: Cannot create manager class de.jollyday.impl.DefaultHolidayManager

Hello,

I have been using jollyday in my project for a couple of years now without incident. However, during a recent test when attempting to upgrade our OS from ubuntu 16.04 LTS to 18.04 LTS, we ran into the following issue:

Receive the following exception when executing on ubuntu 18.04 LTS, although the exact same code works when running under ubuntu 16.04 LTS:

java.lang.IllegalStateException: Cannot create manager class de.jollyday.impl.DefaultHolidayManager
at de.jollyday.caching.HolidayManagerValueHandler.instantiateManagerImpl(HolidayManagerValueHandler.java:61)
(...)

Please see the following for a complete test case and further info which illustrates the error:

https://github.com/gitburr/jollyTest

Thank you in advance for your help.

Additional holiday in japan

I've got the feedback from a japanese colleague that there is a new public holiday in japan.
<tns:Fixed month="August" day="11" validFrom="2016" descriptionPropertiesKey="Mountain_DAY"/>

Wikipedia is telling me, that it is valid from 2017. But I think the guy form japan should be right ;)

Is it possible to add it to both versions/branches?

Label Issues

I make a test with german translation
3.10. must be "Tag der Deutschen Einheit" not "German Unity Day"

Documentation is way behind

The only documentation on usage I can find is on SourceForge and it uses examples using deprecated methods.

I'm not sure how to use the library now as intended, not using deprecated methods. Or did I miss more up-to-date documentation somewhere?

LocalDateBackwardHandler doesn't work properly

Let's say 1/11/2018 and 2/11/2018 is a custom holiday and 3/11/2018 and 4/11/2018 are a holiday. I am trying to calculate a business date one day before 5/11/2018. But I am getting the next business date as 5/11/2018. Although I have instantiated LocalDateBackwardHandler. Problem is adjustDate(), which is implemented in LocalDateForwardHandler. LocalDateBackwardHandler doesn't have its own adjustDate().
So it doesn't calculate the business date properly

US Holidays XML

I inspected the XML file for the US Holidays over on the SourceForge page. Some of the Federal holidays need to be updated. I am happy to make the updates... but I don't know where... or how. Now that the code is here on GitHub, have the holidays files moved too? If so, I did not locate them. If the XML is still over on SourceForge, how do I provide updates? I could download the XML and make the necessary edits and post the update back. I just want to ensure that I grab the latest contributed XML and that I know how/where to make the updates.

Cheers!

Mike

New German Holidays

31.10 "Tag der Reformation" (beginning from 2018!) is holiday in
Brandenburg, Mecklenburg-Vorpommern, Sachsen, Sachsen-Anhalt, Thüringen, Bremen, Hamburg, Schleswig-Holstein und Niedersachsen.

Question

Is there a way to get all supported countries and their provinces at run time?

can not get instance with url

The code-description on your site still states that it is possible to call
HolidayManager hm = HolidayManager.getInstance(url);
But the method is no longer available. Is there a new way to load a config.xml?

RelativeToEasterSunday every not working

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?

Kings day in the Netherlands

The Kings birthday in the Netherlands is celebrated on the 27th of April, except when this falls on a Sunday and it is celebrated on the Saturday instead.

It should be:
<tns:Fixed month="APRIL" day="27" validFrom="2014" descriptionPropertiesKey="KINGS_DAY"> <tns:MovingCondition substitute="SUNDAY" with="PREVIOUS" weekday="SATURDAY"/> </tns:Fixed>

Init HolidayManager by Locale behaves different, depending on Locale.getDefault()

See following snippet:

	ManagerParameter parameters = ManagerParameters.create(Locale.GERMAN);
	HolidayManager mgr = HolidayManager.getInstance(parameters);

	Set<Holiday> holidays = mgr.getHolidays(2018);

The resulting set is correct as long as the default locale of the system is GERMAN, but wrong as soon as it is run with a different system/default locale.

The result should always be the german holidays regardless of the system's locale.

Austrian holiday

Hi Sven,
I'm using the austrian holidays.
The xml of "Burgenland" contains one minor bug.
<tns:Fixed month="NOVEMBER" day="11" descriptionPropertiesKey="MARTINS_TAG"/>
"MARTINS_TAG" should be "MARTINS_DAY", otherwise it says description undefined.

Thanks for your great work!!
Frank

Germany: Reformationstag as one-time public holiday

2017 we will have Reformationstag (2017-10-31) as public holiday in all of Germany, but only that year.
I suppose one has to add a Fixed entry with validFrom and validTo at the top of Holidays_de.xml.
Is this already in the works or do you want a pull request?

Cheers, Joachim

Slovenian holiday removed

Hi,

Slovenia (si) has removed 2.may as holliday. Holliday was remove last year.

jollyday/src/main/resources/holidays/Holidays_si.xml

Greetings

Reimplement not using JAXB?

Are you guys thinking of/open to changing the data loading to not use JAXB any more?

That dependency seems a bit of a nuisance now that various Java EE module including JAXB have been removed from Java SE….

Unofficial holidays

Hi,

it would be nice if we could check if selected day is holiday and specify weather we would like to check unofficial holidays or not.

Currently:
isHoliday = manager.isHoliday(calendar, countryPrefix);

New:
isHoliday = manager.isHoliday(calendar, countryPrefix, checkUnofficial);

Greating, Rok

Austrian holidays

Hello,

this is a bit complicated.

The resource file for Austrian holidays
https://github.com/svendiedrichsen/jollyday/blob/master/src/main/resources/holidays/Holidays_at.xml
lists Christmas Eve (24 Dec) and New Years Eve (31 Dec) as official holidays.

However:
https://www.arbeiterkammer.at/beratung/arbeitundrecht/Arbeitszeit/ArbeitszeitundRuhepausen/Feiertagsruhe.html#heading_Diese_Feiertage_stehen_allen_Beschaeftigten_zu

They are not official holidays.
Although most collective labour agreements treat them as half a work day each.

I think that their HolidayType should return false for isOfficialHoliday().

Will you consider changing them?

Is it possible to create a HolidayManager from a given Locale?

I already asked this question on StackOverflow, but already got a comment that the question might be offtopic... I hope this is the right place to ask this.

In my application the user can set her Locale from a list of available locales. The application then needs to determine if a given date is a holiday.

Here is my current code:

public boolean isHoliday(Calendar cal) {
    HolidayManager m = HolidayManager.getInstance();
    return m.isHoliday(cal);
}

I can change this to the following code to set a specific HolidayCalendar:

public boolean isHoliday(Calendar cal) {
    HolidayManager m = HolidayManager.getInstance(HolidayCalendar.GERMANY);
    return m.isHoliday(cal);
}

But this method is deprecated and I would need to figure out which HolidayCalendar I need based on the user locale. What I want to do is something like this:

public boolean isHoliday(Calendar cal, Locale loc) {
    HolidayManager m = HolidayManager.getInstance(loc);
    return m.isHoliday(cal);
}

I know that HolidayManager is using Locale.getDefault() and there are public methods in Holiday too (see here) but I can not figure out how to do this and the documentation is very brief.

My question: Can I get the holidays based on a particular locale? Do I have to write a major switch statement for all the locales to match a HolidayCalendar?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.