Reminder: we have moved to GitHub .
2022-01-11 : version 1.4.8 is out, updated dependencies to remove Security warnings.
2014-08-26 : version 1.4.0 is out and contains a new Immutable and thread safe Currency Calculator. This uses a Builder pattern. You should use this for any calculation for a currency pair, do not forget to register the holidays for each currency prior to getting the calculator. Spot rules for Latin American currencies on T+1 are handled as well as the Arabic currencies with different weekends. More info about Currency Date Calculation and on the changes here . Finally, we are also introducing a new module the ObjectLab Kit FX Calculator use it for determining Cross Currency Market Conventions and calculating FX Cross Rates.
2014-05-26 : version 1.3.0 is out and contains a couple of changes to make the usage of the interfaces more fluent but mainly include a NEW MODULE FOR JDK8. We also officially release the objectlab-utils module for the first time, if you deal with BigDecimal, Collections etc and are fed up with nulls, this is for you! More info on the changes here .
2010-05-10 : version 1.2.0 is out and contains a couple of changes, including the ability to see the registered calendar and unregistering calendars (useful if calendars are dynamic). More info on the changes here . Also, one of the authors is on Twitter, follow your favorite Belgian at http://twitter.com/benoitx .
2007-03-25: version 1.1.0 is out and contains a couple of changes, a new HolidayHandler and the ability to define a valid range for the holiday (and if the calculation is beyond that range, an exception is thrown). This is done via HolidayCalendar which should replace the simple Set<E> for holidays. More info on the changes here .
ObjectLab Kit came out of our frustration to have to re-do the same kind of code over and over each time we joined a new company and Bank. Most banks will require basic Date calculation, we did spot another open source project for this but their licence forbids most financial institution from using it. This one is released under the business-friendly Apache 2.0 license.
DateCalc comes in 3 different implementations, both run on JDK 1.8 or higher :
If you're using Maven, setup is easy, as DateCalc is in the Maven Central Repository.
To use the JDK Version:
<dependency> <groupId>net.objectlab.kit</groupId> <artifactId>datecalc-common</artifactId> <version>1.4.1</version> </dependency> <dependency> <groupId>net.objectlab.kit</groupId> <artifactId>datecalc-jdk</artifactId> <version>1.4.1</version> </dependency>
To use the JODA Version (recommended):
<dependency> <groupId>net.objectlab.kit</groupId> <artifactId>datecalc-common</artifactId> <version>1.4.1</version> </dependency> <dependency> <groupId>net.objectlab.kit</groupId> <artifactId>datecalc-joda</artifactId> <version>1.4.1</version> </dependency>
To use the JDK8 Version:
<dependency> <groupId>net.objectlab.kit</groupId> <artifactId>datecalc-common</artifactId> <version>1.4.1</version> </dependency> <dependency> <groupId>net.objectlab.kit</groupId> <artifactId>datecalc-jdk8</artifactId> <version>1.4.1</version> </dependency>
If you are not using Maven, you can download the jars here .
Apart from the very basic "add days" features, most business have to deal with Holidays and what to do when a calculated day falls on a holiday . This library does not attempt to create or guess the holidays, we all know that some bank holidays can be decided at a moment's notice in some markets. All financial institutions or big business will have their own official list of 'holidays' anyway.
Furthermore, "weekends" also need to be handled and some market have a different week to the conventional Monday -> Friday, our library provides you with full flexibility to design a Working Week.
As such a Non-working Day can be a holiday or a 'weekend'. Also note that CurrencyPairs have a specialised calculator as the rules can be 'weird'. See for more info .
At the moment, we support the following 6 algorithms:
See this page for some examples .
The main interfaces are:
Here are the examples of how to get a DateCalculator "forward" for the "UK" holidays (if you have registered the holidays). The WorkingWeek is Mon-Fri by default.
There are several steps