Lasso Soft Inc. > Home

[holidayDates]

LinkholidayDates
AuthorJean-Pierre Kocherhans
CategoryDate
Version8.5.x
LicensePublic Domain
Posted19 May 2013
Updated19 May 2013
More by this author...

Description

Return an array of holiday dates for one submitted year. French moving dates that depends on Easter day and custom days you may add as needed.

May be used to check or calculate a delivery date, for instance in a loop as each day is found in the array to delay the delivery ...

Originally used, and translated in LassoScript from a FileMaker calculation !

Sample Usage

holidayDates(2013);

Returns :
array: (03/31/2013 00:00:00), (04/01/2013 00:00:00), (05/09/2013 00:00:00), (05/19/2013 00:00:00), (04/22/2013 00:00:00), (05/01/2013 00:00:00), (05/08/2013 00:00:00), (07/14/2013 00:00:00), (08/15/2013 00:00:00), (11/01/2013 00:00:00), (11/11/2013 00:00:00), (12/25/2013 00:00:00), (12/24/2013 00:00:00), (12/31/2013 00:00:00) 


// where #year, #month, #day, #hour, #minute are defined before
// from a date as 2/21/2013 10:30:00 for instance

local : 'holidayDates' = holidayDates(#year);
local : 'deliveryDate' = Date (-Year = #year , -Month = #month, -Day = #day, -Hour= #hour, -minute = #minute) ;;

if : #holidayDates->(contains : Date ( -Year = Date_GetYear(#deliveryDate), -month=Date_GetMonth(#deliveryDate), -day= Date_GetDay(#deliveryDate)));
	#deliveryDate = Date ( -Year = Date_GetYear(#deliveryDate), -month=Date_GetMonth(#deliveryDate), -day= Date_GetDay(#deliveryDate) +1);
/if;

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

define_tag : 'holidayDates', -required='year';

	local : 'year' = integer(#year);
	
	// Les jours fériés variables  - Moving holiday dates
	
	local : 'G' = #year % 19;
	local : 'C' = Math_Floor (#year / 100);
	local : 'H' = ( #C - Math_Floor(#C / 4) - Math_Floor( (8 * #C + 13) / 25) + 19 * #G + 15)  % 30;
	local : 'I' =  #H - Math_Floor(#H / 28) * ( 1 - Math_Floor( #H / 28 ) * Math_Floor(29/(#H+1))*Math_Floor((21-#G)/11));
	local : 'J' = (#year * 1 + Math_Floor( #year/4 )+ #I + 2 - # C+ Math_Floor( #C / 4 ) ) % 7;
	local : 'L' = #I - #J ;
	
	local : 'MoisPaques' = 3 + Math_Floor ( (#L+40) / 44 ) ; // Easter month
	local : 'JourPaques' = #L + 28 - 31 * Math_Floor (#MoisPaques / 4 ); // Easter day
	local : 'Paques' = Date (-Year = #year , -Month = #MoisPaques, -Day =#JourPaques ); // Easter date
									
	local : 'LundiPaques' = Date (-Year = #year , -Month = #MoisPaques, -Day = #JourPaques + 1) ; // Easter monday
	local : 'Ascension'  = Date (-Year = #year , -Month = #MoisPaques , -Day = #JourPaques + 39);
	local : 'Pentecote'  = Date (-Year = #year , -Month = #MoisPaques, -Day = #JourPaques + 49);
	local : 'LundiPentecote' = Date (-Year = #year , -Month = #MoisPaques, -Day = #JourPaques + 50); 
		
	// Les jours fériés fixes - fixed holidays

	local : 'JourAn' =Date (-Year = #year , -Month = 1, -Day = 1); // NewYear Day
	local : 'FeteTravail' =Date (-Year = #year , -Month = 5, -Day = 1);
	local : 'Victoire1945' =Date (-Year = #year , -Month = 5, -Day = 8);
	local : 'FeteNationale' =Date (-Year = #year , -Month = 7, -Day = 14); // National day
	local : 'Assomption' =Date (-Year = #year , -Month = 8, -Day = 15);
	local : 'Toussaint' =Date (-Year = #year , -Month = 11, -Day = 1);
	local : 'Armistice' =Date (-Year = #year , -Month = 11, -Day =11 );
	local : 'Noel' =Date (-Year = #year , -Month = 12, -Day = 25); // Xmas
	
	// Jour de fermetures perso fixes - Other custom closed days
	
	local : 'pont1' =Date (-Year = #year , -Month = 12, -Day =24 );
	local : 'pont2' =Date (-Year = #year , -Month =12 , -Day = 31);
	

	local : 'holidayDates' = (: #Paques, #LundiPaques, #Ascension, #Pentecote, #LundiPentecote, #FeteTravail, #Victoire1945, #FeteNationale, #Assomption, #Toussaint, #Armistice, #Noel, #pont1, #pont2);
	
	Return : #holidayDates;
	
/define_tag;

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft