manage referential of computed date. Every country are managed by a configuration file in json format. A console application can generate computed date, for using out of custom development. you can download all releases of the github relaser folder
[Here] : https://github.com/Black-Beard-Sdk/Calendarium/releases
# return the list of all configurations available by nuget package. make a search on nuget.org of all packages matches with "black.Beard.Calendarium.*"
PS D:\Calen\bin> .\Calendarium config list
available countries parameters:
ββββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββ
β Name : France β Name : Costa_Rica β
β OnlineVersion : 1.0.82 β OnlineVersion : 1.0.82 β
β Included : False β Included : False β
ββββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββ€
β Name : Peru β Name : Croatia β
β OnlineVersion : 1.0.82 β OnlineVersion : 1.0.82 β
β Included : False β Included : False β
ββββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββ€
β Name : Russia β Name : Andorra β
β OnlineVersion : 1.0.82 β OnlineVersion : 1.0.82 β
β Included : False β Included : False β
ββββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββ€
...
# add a new country in local configuration.
PS D:\Calen\bin> .\Calendarium config add france
France updating in the version 1.0.83
Download
Uncompress
Save
available countries parameters:
βββββββββββββββββββββββββββ
β Name : France β
β OnlineVersion : 1.0.83 β
β Included : True β
βββββββββββββββββββββββββββ
# generate all dates for country france for one year from begining of current year. all dates are writed in a file nammed output.csv note that if you dont specify the country, all countries included in the configurations will be generated.
PS D:\Calen\bin> .\Calendarium compute output.csv 1 france
configuration France is loaded
computed dates:
ββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β Date : 01/11/2020 β Date : 12/04/2020 β
β Observed : 01/11/2020 β Observed : 12/04/2020 β
β DateEnd : null β DateEnd : null β
β Free : True β Free : True β
β Name : All Saints' Day β Name : Easter Sunday β
β Culture : fr-FR β Culture : fr-FR β
β Country : France β Country : France β
β Region : β Region : β
ββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β Date : 11/11/2020 β Date : 31/05/2020 β
β Observed : 11/11/2020 β Observed : 31/05/2020 β
β DateEnd : null β DateEnd : null β
β Free : True β Free : True β
β Name : Armistice Day 1918 β Name : Pentecost β
β Culture : fr-FR β Culture : fr-FR β
β Country : France β Country : France β
β Region : β Region : β
ββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β Date : 01/01/2020 β Date : 01/01/2021 β
β Observed : 01/01/2020 β Observed : 01/01/2021 β
β DateEnd : null β DateEnd : null β
β Free : True β Free : True β
β Name : New Year's Day β Name : New Year's Day β
β Culture : fr-FR β Culture : fr-FR β
β Country : France β Country : France β
β Region : β Region : β
ββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β Date : 08/05/2020 β Date : 08/05/2021 β
β Observed : 08/05/2020 β Observed : 08/05/2021 β
β DateEnd : null β DateEnd : null β
β Free : True β Free : True β
β Name : Victory Day β Name : Victory Day β
β Culture : fr-FR β Culture : fr-FR β
β Country : France β Country : France β
β Region : β Region : β
ββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β Date : 01/05/2020 β Date : 01/05/2021 β
β Observed : 01/05/2020 β Observed : 01/05/2021 β
β DateEnd : null β DateEnd : null β
β Free : True β Free : True β
β Name : Labor Day β Name : Labor Day β
β Culture : fr-FR β Culture : fr-FR β
β Country : France β Country : France β
β Region : β Region : β
ββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β Date : 14/07/2020 β Date : 14/07/2021 β
β Observed : 14/07/2020 β Observed : 14/07/2021 β
β DateEnd : null β DateEnd : null β
β Free : True β Free : True β
β Name : Bastille Day β Name : Bastille Day β
β Culture : fr-FR β Culture : fr-FR β
β Country : France β Country : France β
β Region : β Region : β
ββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β Date : 21/05/2020 β Date : 13/05/2021 β
β Observed : 21/05/2020 β Observed : 13/05/2021 β
β DateEnd : null β DateEnd : null β
β Free : True β Free : True β
β Name : Ascension β Name : Ascension β
β Culture : fr-FR β Culture : fr-FR β
β Country : France β Country : France β
β Region : β Region : β
ββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β Date : 15/08/2020 β Date : 05/04/2021 β
β Observed : 15/08/2020 β Observed : 05/04/2021 β
β DateEnd : null β DateEnd : null β
β Free : True β Free : True β
β Name : Assumption β Name : Easter Monday β
β Culture : fr-FR β Culture : fr-FR β
β Country : France β Country : France β
β Region : β Region : β
ββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β Date : 25/12/2020 β Date : 24/05/2021 β
β Observed : 25/12/2020 β Observed : 24/05/2021 β
β DateEnd : null β DateEnd : null β
β Free : True β Free : True β
β Name : Christmas Day β Name : Pentecost Monday β
β Culture : fr-FR β Culture : fr-FR β
β Country : France β Country : France β
β Region : β Region : β
ββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β Date : 13/04/2020 β Date : 02/04/2021 β
β Observed : 13/04/2020 β Observed : 02/04/2021 β
β DateEnd : null β DateEnd : null β
β Free : True β Free : True β
β Name : Easter Monday β Name : Good Friday β
β Culture : fr-FR β Culture : fr-FR β
β Country : France β Country : France β
β Region : β Region : β
ββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β Date : 01/06/2020 β Date : 04/04/2021 β
β Observed : 01/06/2020 β Observed : 04/04/2021 β
β DateEnd : null β DateEnd : null β
β Free : True β Free : True β
β Name : Pentecost Monday β Name : Easter Sunday β
β Culture : fr-FR β Culture : fr-FR β
β Country : France β Country : France β
β Region : β Region : β
ββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ€
β Date : 10/04/2020 β Date : 23/05/2021 β
β Observed : 10/04/2020 β Observed : 23/05/2021 β
β DateEnd : null β DateEnd : null β
β Free : True β Free : True β
β Name : Good Friday β Name : Pentecost β
β Culture : fr-FR β Culture : fr-FR β
β Country : France β Country : France β
β Region : β Region : β
ββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββ
PS D:\Calen\bin>
Sample of csv output
Name;StartDate;EndDate;ObservedDate;Country;Culture;Free;Calendar
All Saints' Day;01/11/2020 00:00:00;;01/11/2020;France;fr-FR;true;Gregorian
Armistice Day 1918;11/11/2020 00:00:00;;11/11/2020;France;fr-FR;true;Gregorian
New Year's Day;01/01/2020 00:00:00;;01/01/2020;France;fr-FR;true;Gregorian
Victory Day;08/05/2020 00:00:00;;08/05/2020;France;fr-FR;true;Gregorian
Labor Day;01/05/2020 00:00:00;;01/05/2020;France;fr-FR;true;Gregorian
Bastille Day;14/07/2020 00:00:00;;14/07/2020;France;fr-FR;true;Gregorian
Ascension;21/05/2020 00:00:00;;21/05/2020;France;fr-FR;true;Gregorian
Assumption;15/08/2020 00:00:00;;15/08/2020;France;fr-FR;true;Gregorian
Christmas Day;25/12/2020 00:00:00;;25/12/2020;France;fr-FR;true;Gregorian
Easter Monday;13/04/2020 00:00:00;;13/04/2020;France;fr-FR;true;Gregorian
Pentecost Monday;01/06/2020 00:00:00;;01/06/2020;France;fr-FR;true;Gregorian
Good Friday;10/04/2020 00:00:00;;10/04/2020;France;fr-FR;true;Gregorian
Easter Sunday;12/04/2020 00:00:00;;12/04/2020;France;fr-FR;true;Gregorian
Pentecost;31/05/2020 00:00:00;;31/05/2020;France;fr-FR;true;Gregorian
New Year's Day;01/01/2021 00:00:00;;01/01/2021;France;fr-FR;true;Gregorian
Victory Day;08/05/2021 00:00:00;;08/05/2021;France;fr-FR;true;Gregorian
Labor Day;01/05/2021 00:00:00;;01/05/2021;France;fr-FR;true;Gregorian
Bastille Day;14/07/2021 00:00:00;;14/07/2021;France;fr-FR;true;Gregorian
Ascension;13/05/2021 00:00:00;;13/05/2021;France;fr-FR;true;Gregorian
Easter Monday;05/04/2021 00:00:00;;05/04/2021;France;fr-FR;true;Gregorian
Pentecost Monday;24/05/2021 00:00:00;;24/05/2021;France;fr-FR;true;Gregorian
Good Friday;02/04/2021 00:00:00;;02/04/2021;France;fr-FR;true;Gregorian
Easter Sunday;04/04/2021 00:00:00;;04/04/2021;France;fr-FR;true;Gregorian
Pentecost;23/05/2021 00:00:00;;23/05/2021;France;fr-FR;true;Gregorian
all sdk is available in a single library in a package nuget.
PM> Install-Package Black.Beard.Calendarium -Version 1.0.83
// Load all configuration files in a specific folder
var dir = new System.IO.DirectoryInfo(Path.Combine(Environment.CurrentDirectory, "Configuration/Countries"));
// Load all configurations of the specified folder
var loader = new ConfigurationLoader(dir).Load();
// Initialize
var cal = CalendariumConfiguration.GetCalendarium
(
loader
);
// Get all dates for country france
int year = DateTime.Now.Year;
var dates = cal.GetDates(year, "France");
the result date is converter in current thread culture calendar
- France
- Germany
- Luxembourg
- Belgium
- Andorra
- Austria
- Portugal
- Croatia
- San_Marino
- Malta
- Estonia
- Ecuador
- Italy
- India
- Czechia
- Nicaragua
- Peru
- Slovakia
- Slovenia
- Holy_See_Vatican_City
- Armenia
- Monaco
- Russia
- El_Salvador
- Costa_Rica
- Saudi_Arabia
- Algeria
you can create or tune a configuration. You can use intelisense for help you.
Country will by used by key for match with the country.
Calendar specify the calendar by default for the configuration file. the calendar can be tuned in the period
Regions is an array of object with a key and an array of period. for the france configuration, the key is two first number of the zipcode. regions can tune a specific rule for a part of country. Region contains a property From for copy a region source by this key.
Periods is an array of rule.
β Name is writed in english (by convention).
β Free is true/false if the day is worked or not.
β Tags is an array of string tag.
β Culture code is a key
β RuleDate contains the rule for building the date
β RuleObserved contains the rule for building the observed date. for any countries the observed date is the free day different of the holiday calculated.
β RuleRuration contains the rule for building the duration festivity. sometime the festivity can during any day like carnaval.
β YearFrom specifiy the first year when the festivity iwas created.
{
"$schema": "/_schema.CountryConfiguration.json",
"Country": "Poland",
"Regions": [ {"Key":"", "Periods":[ ] } ],
"Periods": [
{
"Name": "Fat Thursday",
"RuleDate": "([EASTER]) - 51",
"RuleObserved": null,
"RuleDuration": null,
"Free": false,
"Translations": [ {"Language":"French", "Name":"Mardi gras" } ],
"Tags": [],
"YearFrom": 2014
}
],
"Culture": "pl",
"Calendar": "Gregorian"
}
Language is an enumeration
- Undefined
- French
- German
- English
- Dutch
- Italian
- Estonian
- Latvian
- Lithuanian
- Spanish
- Romania
- Slovak
- Slovenian
- Croatian
- Czech
- Polish
- Hungarian
- Portuguese
- Russian
- Finnish
- Norwgian
- Danish
- Swedish
Calendar is an enumeration
- Default. use the calendar of the current culture.
- Gregorian
- Hebrew
- UmAlQura
- Hijri
- Japanese
- JapaneseLunisolar
- Julian
- Korean
- KoreanLunisolar
- Persian
- Taiwan
- TaiwanLunisolar
- ThaiBuddhist
lexer grammar CalendariumLexer;
YEAR : 'YEAR';
MONTH : 'MONTH';
DAY : 'DAY';
DAYWEEK : 'DAYWEEK';
MONDAY : 'MONDAY';
TUESDAY : 'TUESDAY';
WEDNESDAY : 'WEDNESDAY';
THURSDAY : 'THURSDAY';
FRIDAY : 'FRIDAY';
SATURDAY : 'SATURDAY';
SUNDAY : 'SUNDAY';
// and a superfluous subtoken typecasting of the "QUOTE"
CHAR_STRING: '\'' (~('\'' | '\r' | '\n') | '\'\'')+ '\'';
// SQL_SPECIAL_CHAR was split into single rules
LEFT_PAREN : '(';
LEFT_BRACKET : '[';
RIGHT_PAREN : ')';
RIGHT_BRACKET : ']';
COLON : ':';
SEMICOLON : ';';
COMMA : ',';
PLUS : '+';
MINUS : '-';
TIME : '*';
DOT : '.';
DIVID : '\\';
NOT : '!';
EQUAL : '=';
MODULO : '%';
POWER : '^';
NOT_EQUAL : '!=';
GREATER : '>';
GREATER_OR_EQUAL : '>=';
LESS : '<';
LESS_OR_EQUAL : '<=';
XOR : '||';
OR : '|';
AND : '&';
ANDALSO : '&&';
SLASH : '\\';
INTEROGATION : '?';
SPACES: [ \t\r\n]+ -> skip;
// Rule #504 <SIMPLE_LETTER> - simple_latin _letter was generalised into SIMPLE_LETTER
// Unicode is yet to be implemented - see NSF0
fragment
SIMPLE_LETTER
: [A-Za-z]
;
NUMBER
: [0-9]+
;
// Rule #097 <COMMENT>
SINGLE_LINE_COMMENT: '--' ~('\r' | '\n')* EOF -> channel(HIDDEN);
MULTI_LINE_COMMENT: '/*' .*? '*/' -> channel(HIDDEN);
fragment
SPACE: [ \t];
REGULAR_ID: SIMPLE_LETTER (SIMPLE_LETTER | '$' | '_' | '#' | [0-9])*;
parser grammar CalendariumParser;
options {
// memoize=True;
tokenVocab=CalendariumLexer;
}
script :
expression
| INTEROGATION expression_bool COLON expression
;
expression_bool
: dayweek (OR dayweek)?
| LEFT_PAREN expression_bool RIGHT_PAREN
;
expression :
rule expression?
| LEFT_PAREN expression RIGHT_PAREN expression?
// | NOT expression expression?
| operation expression
;
operation :
PLUS | MINUS
// | TIME | DIVID
// | MODULO
// | EQUAL | NOT_EQUAL
// | GREATER | GREATER_OR_EQUAL | LESS | LESS_OR_EQUAL
// | AND | ANDALSO | OR | XOR
// | (PLUS PLUS)
| (GREATER GREATER)
| (LESS LESS)
;
rule :
mask
| LEFT_BRACKET identifier RIGHT_BRACKET
| TIME? dayweek
| NUMBER
;
mask :
month=NUMBER MINUS day=NUMBER
;
dayweek : MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY | SATURDAY | SUNDAY;
identifier : REGULAR_ID;
Keys for internal computings
- EASTER
- ORTHODOX_EASTER
# mask : build christmas all 25 december
"RuleDate" : "12-25"
# mask : build Eid all 12 of 10 th month in hijri calendar. the date is converted in current local calendar
"RuleDate" : "12-10"
"Calendar" : "Hijri"
# mask : build easter
"RuleDate" : "[EASTER]"
# mask : build Ascension 40 days after Easter
"RuleDate" : "([EASTER]) + 39"
# mask : build Day of Prayer and Repentance (germany holiday). first westerday before 23 november.
"RuleDate" : "((11-23) - 1) << Wednesday"