Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Request #19719 Extend Netherlands driver

  • Loading branch information...
commit 0309a5709051fda35c3786e91d7e2e8ab5d7ae7f 1 parent 1bbab94
@kenguest kenguest authored
View
274 Date/Holidays/Driver/Netherlands.php
@@ -18,8 +18,9 @@
* @category Date
* @package Date_Holidays
* @author Jos van der Woude <jos@veerkade.com>
+ * @author Arjen de Korte <build+date_holidays@de-korte.org>
* @license http://www.php.net/license/3_01.txt PHP License 3.0.1
- * @version CVS: $Id$
+ * @version CVS: $Id: Netherlands.php,v 1.9 2009/03/15 20:17:00 kguest Exp $
* @link http://pear.php.net/package/Date_Holidays
*/
@@ -32,8 +33,9 @@
* @package Date_Holidays
* @subpackage Driver
* @author Jos van der Woude <jos@veerkade.com>
+ * @author Arjen de Korte <build+date_holidays@de-korte.org>
* @license http://www.php.net/license/3_01.txt PHP License 3.0.1
- * @version $Id$
+ * @version $Id: Netherlands.php,v 1.9 2009/03/15 20:17:00 kguest Exp $
* @link http://pear.php.net/package/Date_Holidays
*/
@@ -69,116 +71,272 @@ function Date_Holidays_Driver_Netherlands()
function _buildHolidays()
{
/**
+ * Start with all holidays that are on a fixed date each year
+ */
+
+ /**
* New Year's Day
*/
- $this->_addHoliday('newYearsDay',
- $this->_year . '-01-01',
- 'New Year\'s Day');
- $this->_addTranslationForHoliday('newYearsDay', 'DU_NL', 'Nieuwjaarsdag');
+ $this->_addHoliday(
+ 'newYearsDay',
+ $this->_year . '-01-01',
+ 'New Year\'s Day'
+ );
/**
* Epiphanias
*/
$this->_addHoliday('epiphany', $this->_year . '-01-06', 'Epiphany');
- $this->_addTranslationForHoliday('epiphany', 'DU_NL', 'Drie Koningen');
/**
* Valentine's Day
*/
- $this->_addHoliday('valentineDay',
- $this->_year . '-02-14',
- 'Valentine\'s Day');
- $this->_addTranslationForHoliday('valentineDay', 'DU_NL', 'Valentijnsdag');
+ $this->_addHoliday(
+ 'valentineDay',
+ $this->_year . '-02-14',
+ 'Valentine\'s Day'
+ );
/**
* Queen's Day
*/
$this->_addHoliday('queenDay', $this->_year . '-04-30', 'Queen\'s Day');
- $this->_addTranslationForHoliday('queenDay', 'DU_NL', 'Koninginnedag');
/**
- * Commemoration Day Day
+ * Labour Day
*/
- $this->_addHoliday('commemorationDay',
- $this->_year . '-05-04',
- 'Commemoration Day');
- $this->_addTranslationForHoliday('commemorationDay',
- 'DU_NL',
- 'Dodenherdenking');
+ $this->_addHoliday('labourDay', $this->_year . '-05-01', 'Labour Day');
+
+ /**
+ * Commemoration Day
+ */
+ $this->_addHoliday(
+ 'commemorationDay',
+ $this->_year . '-05-04',
+ 'Commemoration Day'
+ );
/**
* Liberation Day
*/
- $this->_addHoliday('liberationDay',
- $this->_year . '-05-05',
- 'Liberation Day');
- $this->_addTranslationForHoliday('liberationDay', 'DU_NL', 'Bevrijdingsdag');
+ $this->_addHoliday(
+ 'liberationDay',
+ $this->_year . '-05-05',
+ 'Liberation Day'
+ );
+ /**
+ * World Animal Day
+ */
+ $this->_addHoliday(
+ 'worldAnimalDay',
+ $this->_year . '-10-04',
+ 'World Animal Day'
+ );
/**
- * Easter Sunday
+ * Halloween
+ */
+ $this->_addHoliday('halloween', $this->_year . '-10-31', 'Halloween');
+
+ /**
+ * St. Martins Day
+ */
+ $this->_addHoliday(
+ 'stMartinsDay',
+ $this->_year . '-11-11',
+ 'St. Martin\'s Day'
+ );
+
+ /**
+ * St. Nicholas' Day
+ */
+ $this->_addHoliday(
+ 'stNicholasDay',
+ $this->_year . '-12-05',
+ 'St. Nicholas\' Day'
+ );
+
+ /**
+ * Christmas day
+ */
+ $this->_addHoliday(
+ 'christmasDay',
+ $this->_year . '-12-25',
+ 'Christmas Day'
+ );
+
+ /**
+ * Second Christmas Day
+ */
+ $this->_addHoliday(
+ 'secondChristmasDay',
+ $this->_year . '-12-26',
+ 'Boxing Day'
+ );
+
+ /**
+ * New Year's Eve
+ */
+ $this->_addHoliday(
+ 'newYearsEve',
+ $this->_year . '-12-31',
+ 'New Year\'s Eve'
+ );
+
+
+ /**
+ * Following section is holidays that are a fixed offset from Easter (which
+ * differs each year)
*/
$easterDate = Date_Holidays_Driver_Christian::calcEaster($this->_year);
+
+ /**
+ * Carnival
+ */
+ $this->_addHoliday(
+ 'carnival1',
+ $this->_addDays($easterDate, -49),
+ 'Carnival'
+ );
+ $this->_addHoliday(
+ 'carnival2',
+ $this->_addDays($easterDate, -48),
+ 'Carnival'
+ );
+ $this->_addHoliday(
+ 'carnival3',
+ $this->_addDays($easterDate, -47),
+ 'Carnival'
+ );
+
+ /**
+ * Ash Wednesday
+ */
+ $this->_addHoliday(
+ 'ashWednesday',
+ $this->_addDays($easterDate, -46),
+ 'Ash Wednesday'
+ );
+
+ /**
+ * Green Thursday
+ */
+ $this->_addHoliday(
+ 'greenThursday',
+ $this->_addDays($easterDate, -3),
+ 'Green Thursday'
+ );
+
+ /**
+ * Good Friday / Black Friday
+ */
+ $this->_addHoliday(
+ 'goodFriday',
+ $this->_addDays($easterDate, -2),
+ 'Good Friday'
+ );
+
+ /**
+ * Silent Saturday
+ */
+ $this->_addHoliday(
+ 'silentSaturday',
+ $this->_addDays($easterDate, -1),
+ 'Silent Saturday'
+ );
+
+ /**
+ * Easter Sunday
+ */
$this->_addHoliday('easter', $easterDate, 'Easter Sunday');
- $this->_addTranslationForHoliday('easter', 'DU_NL', '1e Paasdag');
/**
* Easter Monday
*/
- $this->_addHoliday('easterMonday',
- $easterDate->getNextDay(),
- 'Easter Monday');
- $this->_addTranslationForHoliday('easterMonday', 'DU_NL', '2e Paasdag');
+ $this->_addHoliday(
+ 'easterMonday',
+ $this->_addDays($easterDate, 1),
+ 'Easter Monday'
+ );
/**
- * Good Friday / Black Friday
+ * Ascension Day
*/
- $goodFridayDate = $this->_addDays($easterDate, 2);
- $this->_addHoliday('goodFriday', $goodFridayDate, 'Good Friday');
- $this->_addTranslationForHoliday('goodFriday', 'DU_NL', 'Goede Vrijdag');
+ $this->_addHoliday(
+ 'ascensionDay',
+ $this->_addDays($easterDate, 39),
+ 'Ascension Day'
+ );
/**
- * Whitsun (determines Whit Monday, Ascension Day and Feast of
- * Corpus Christi)
+ * Whitsun
*/
- $whitsunDate = $this->_addDays($easterDate, 49);
- $this->_addHoliday('whitsun', $whitsunDate, 'Whitsun');
- $this->_addTranslationForHoliday('whitsun', 'DU_NL', '1e Pinksterdag');
+ $this->_addHoliday('whitsun', $this->_addDays($easterDate, 49), 'Whitsun');
/**
* Whit Monday
*/
- $this->_addHoliday('whitMonday', $whitsunDate->getNextDay(), 'Whit Monday');
- $this->_addTranslationForHoliday('whitMonday', 'DU_NL', '2e Pinksterdag');
+ $this->_addHoliday(
+ 'whitMonday',
+ $this->_addDays($easterDate, 50),
+ 'Whit Monday'
+ );
+
/**
- * Ascension Day
+ * Lastly a number of holidays that are the second/third/last Sunday
+ * or Tuesday in a specific month (offset is calculated from the first
+ * of last possible date)
*/
- $ascensionDayDate = $this->_addDays($whitsunDate, -10);
- $this->_addHoliday('ascensionDay', $ascensionDayDate, 'Ascension Day');
- $this->_addTranslationForHoliday('ascensionDay', 'DU_NL', 'Hemelvaartsdag');
/**
- * Christmas day
+ * Summertime last sunday of march
*/
- $this->_addHoliday('christmasDay', $this->_year . '-12-25', 'Christmas Day');
- $this->_addTranslationForHoliday('christmasDay', 'DU_NL', '1e Kerstdag');
+ $summerTime = new Date($this->_year . '-03-31');
+ $dayOfWeek = $summerTime->getDayOfWeek();
+ $summerTime = $this->_addDays($summerTime, -$dayOfWeek);
+ $this->_addHoliday('summerTime', $summerTime, 'Summertime');
/**
- * Second Christmas Day
+ * Mothers' Day second sunday of may
*/
- $this->_addHoliday('secondChristmasDay',
- $this->_year . '-12-26',
- 'Boxing Day');
- $this->_addTranslationForHoliday('secondChristmasDay',
- 'DU_NL',
- '2e Kerstdag');
+ $mothersDay = new Date($this->_year . '-05-08');
+ $dayOfWeek = $mothersDay->getDayOfWeek();
+ if ($dayOfWeek != 0) {
+ $mothersDay = $this->_addDays($mothersDay, 7 - $dayOfWeek);
+ }
+ $this->_addHoliday('mothersDay', $mothersDay, 'Mothers\' Day');
/**
- * New Year's Eve
+ * Fathers' Day third sunday of june
+ */
+ $fathersDay = new Date($this->_year . '-06-15');
+ $dayOfWeek = $fathersDay->getDayOfWeek();
+ if ($dayOfWeek != 0) {
+ $fathersDay = $this->_addDays($fathersDay, 7 - $dayOfWeek);
+ }
+ $this->_addHoliday('fathersDay', $fathersDay, 'Fathers\' Day');
+
+ /**
+ * Start of Parliamentary Year third tuesday of september
+ */
+ $princesDay = new Date($this->_year . '-09-15');
+ $dayOfWeek = $princesDay->getDayOfWeek();
+ if ($dayOfWeek <= 2) {
+ $princesDay = $this->_addDays($princesDay, 2 - $dayOfWeek);
+ } else {
+ $princesDay = $this->_addDays($princesDay, 9 - $dayOfWeek);
+ }
+ $this->_addHoliday('princesDay', $princesDay, 'Start of Parliamentary Year');
+
+ /**
+ * Wintertime last sunday of october
*/
- $this->_addHoliday('newYearsEve', $this->_year . '-12-31', "New Year's Eve");
- $this->_addTranslationForHoliday('newYearsEve', 'DU_NL', 'Oudjaarsdag');
+ $winterTime = new Date($this->_year . '-10-31');
+ $dayOfWeek = $winterTime->getDayOfWeek();
+ $winterTime = $this->_addDays($winterTime, -$dayOfWeek);
+ $this->_addHoliday('winterTime', $winterTime, 'Wintertime');
if (Date_Holidays::errorsOccurred()) {
return Date_Holidays::getErrorStack();
@@ -197,7 +355,7 @@ function _buildHolidays()
*/
function getISO3166Codes()
{
- return array('NL', 'NLD');
+ return array('nl', 'nld');
}
}
?>
View
164 lang/Netherlands/nl_NL.xml
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<driver-data>
+ <holidays>
+
+
+ <holiday>
+ <internal-name>newYearsDay</internal-name>
+ <translation>Nieuwjaarsdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>epiphany</internal-name>
+ <translation>Drie Koningen</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>valentineDay</internal-name>
+ <translation>Valentijnsdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>queenDay</internal-name>
+ <translation>Koninginnedag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>labourDay</internal-name>
+ <translation>Dag van de Arbeid</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>commemorationDay</internal-name>
+ <translation>Dodenherdenking</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>liberationDay</internal-name>
+ <translation>Bevrijdingsdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>worldAnimalDay</internal-name>
+ <translation>Dierendag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>halloween</internal-name>
+ <translation>Halloween</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>stMartinsDay</internal-name>
+ <translation>Sint Maarten</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>stNicholasDay</internal-name>
+ <translation>Sinterklaas</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>christmasDay</internal-name>
+ <translation>Eerste kerstdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>secondChristmasDay</internal-name>
+ <translation>Tweede kerstdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>newYearsEve</internal-name>
+ <translation>Oudjaarsdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>carnival1</internal-name>
+ <translation>Carnaval</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>carnival2</internal-name>
+ <translation>Carnaval</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>carnival3</internal-name>
+ <translation>Carnaval</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>ashWednesday</internal-name>
+ <translation>Aswoensdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>greenThursday</internal-name>
+ <translation>Witte donderdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>goodFriday</internal-name>
+ <translation>Goede vrijdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>silentSaturday</internal-name>
+ <translation>Stille zaterdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>easter</internal-name>
+ <translation>Eerste paasdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>easterMonday</internal-name>
+ <translation>Tweede paasdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>ascensionDay</internal-name>
+ <translation>Hemelvaartsdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>whitsun</internal-name>
+ <translation>Eerste pinksterdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>whitMonday</internal-name>
+ <translation>Tweede pinksterdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>summerTime</internal-name>
+ <translation>Zomertijd</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>mothersDay</internal-name>
+ <translation>Moederdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>fathersDay</internal-name>
+ <translation>Vaderdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>princesDay</internal-name>
+ <translation>Prinsjesdag</translation>
+ </holiday>
+
+ <holiday>
+ <internal-name>winterTime</internal-name>
+ <translation>Wintertijd</translation>
+ </holiday>
+
+
+ </holidays>
+</driver-data>
+
View
29 package_netherlands.xml
@@ -28,10 +28,16 @@
<email>wiesemann@php.net</email>
<active>no</active>
</contributor>
- <date>2009-03-17</date>
- <time>00:41:19</time>
+ <contributor>
+ <name>Arjen de Korte</name>
+ <user>arjen_de_korte</user>
+ <email>build+date_holidays@de-korte.org</email>
+ <active>no</active>
+ </contributor>
+ <date>2012-12-12</date>
+ <time>00:19:19</time>
<version>
- <release>0.1.2</release>
+ <release>0.1.3</release>
<api>0.17.2</api>
</version>
<stability>
@@ -40,7 +46,7 @@
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
- * Utilise fix for Bug #13865: One-hour-shift in Christian driver
+ * Request #19719: Extend Netherlands driver
</notes>
<contents>
<dir baseinstalldir="/" name="/">
@@ -104,5 +110,20 @@
<license uri="http://www.php.net/license">PHP License</license>
<notes>Slight changes to testsuite so it works when installed rather than in developers environment.</notes>
</release>
+ <release>
+ <version>
+ <release>0.1.2</release>
+ <api>0.17.2</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <date>2008-08-23</date>
+ <license uri="http://www.php.net/license">PHP License</license>
+ <notes>
+ * Utilise fix for Bug #13865: One-hour-shift in Christian driver
+ </notes>
+ </release>
</changelog>
</package>
Please sign in to comment.
Something went wrong with that request. Please try again.