Comments (3)
Thank you for the feedback! I'll try to make a fix shortly. I'm also able to review pull requests to patch the package.
from pgsql_holidays.
Since I'm naively porting the code from python, it's hard for me to know if it was implemented correctly upstream. Date shifting wasn't implemented in the python lib for Bulgaria, so thank-you for letting me know that it should be there.
I've made some changes to a new branch of the code ("complex_return_experiment"). I'm looking into a more complex return type so that it would be easier to filter data on parameters that aren't directly knowable from the datestamp. This is partially how I want to address your issue. Could you look at the output below and let me know if it would better suit what you would need?
datestamp | description | authority | day_off | observation_shifted |
---|---|---|---|---|
2020-01-01 | Нова година | national | true | false |
2020-03-03 | Ден на Освобождението на България от османско иго | national | true | false |
2020-04-17 | Велики петък | national | true | false |
2020-04-18 | Велика събота | religious | false | false |
2020-04-19 | Великден | religious | false | false |
2020-04-20 | Велики понеделник | national | true | false |
2020-05-01 | Ден на труда и на международната работническа солидарност | national | true | false |
2020-05-06 | Гергьовден, Ден на храбростта и Българската армия | national | true | false |
2020-05-24 | Ден на българската просвета и култура и на славянската писменост | national | true | false |
2020-05-25 | Ден на българската просвета и култура и на славянската писменост (Observed) | national | true | true |
2020-09-06 | Ден на Съединението | national | true | false |
2020-09-07 | Ден на Съединението (Observed) | national | true | true |
2020-09-22 | Ден на Независимостта на България | national | true | false |
2020-11-01 | Ден на народните будители | national | false | false |
2020-12-24 | Бъдни вечер | national | true | false |
2020-12-25 | Рождество Христово | national | true | false |
2020-12-28 | Рождество Христово | national | true | true |
I'm not fully sure if I should drop the English "(Observed)" tags if I use this format, so I'd be curious about your thoughts on that too.
from pgsql_holidays.
I think that the new return format is excellent and suites both business use and general information cases.
About the English "(Observed)" tags - well, it's good to have of course.
What about declaring something like
OBSERVED constant text := '(компенсация)'; -- Bulgarian
in country functions and then use the constant instead of the literal?
One more thought. Holiday lists and rules are changed every now and then in countries around the world and this may go unnoticed. Maybe local people are the best opportunity for updating.
A more declarative approach could help them do so, something like this HOLIDAY_DEFINITIONS "table" in country functions.
create type holidays.holiday_def as
(
month_value integer,
day_value integer,
description text,
day_off boolean,
authority holidays.jurisdictional_authority,
observation_shift boolean
);
-- declare
HOLIDAY_DEFINITIONS constant holidays.holiday_def[] := array
[
-- MONTH_VALUE DAY_VALUE DESCRIPTION OFF_DAY AUTHORITY SHIFT
(JANUARY, 1, 'Нова година', true, 'national', true),
(MARCH, 3, 'Освобождение от османско иго', true, 'national', true),
(MAY, 1, 'Ден на труда', true, 'national', true),
(MAY, 6, 'Гергьовден', true, 'national', true),
(MAY, 24, 'Ден на писмеността', true, 'national', true),
(SEPTEMBER, 6, 'Ден на Съединението', true, 'national', true),
(SEPTEMBER, 22, 'Ден на Независимостта', true, 'national', true),
(NOVEMBER, 1, 'Ден на народните будители', false, 'national', false)
];
running_holiday holidays.holiday_def;
-- begin
foreach running_holiday in array HOLIDAY_DEFINITIONS loop
-- generic country-independent business logic here
end loop;
Cheers!
from pgsql_holidays.
Related Issues (8)
- Some Croatian holidays have different dates in 2020 HOT 4
- Add Windows support / Automatic Release build
- How about shortened days? HOT 3
- Package as extension HOT 3
- Bug in holidays.find_nth_weekday_date() causing invalid holiday dates
- Bug in south_africa.pgsql
- South African observed Sunday holidays are duplicated when getting holidays for multiple years
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pgsql_holidays.