GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - christopherthompson81/pgsql_holidays: Package to calculate holiday dates in PostgreSQL

BranchesTags
Open more actions menu

Latest commit

 

History

149 Commits
149 Commits

Folders and files

NameName
Last commit message
Last commit date
development_notes
development_notes
 
 
scripts
scripts
 
 
sql
sql
 
 
test
test
 
 
.gitignore
.gitignore
 
 
AUTHORS.md
AUTHORS.md
 
 
LICENSE
LICENSE
 
 
META.json
META.json
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
holidays.control
holidays.control
 
 

Repository files navigation

pgsql_holidays

PostgreSQL extension to calculate holiday dates for any country.

Installation

Build and install PostgreSQL extension

You can build and install the extension using the following commands:

	make
	make installcheck
	sudo make install

NB. Chinese, Hebrew, Hijri, Hindu, and Jalali calendar functions require another of my libraries: calendar_converter_pgsql

Usage

You can select holidays from the new schema for your country using the following syntax. Where there are no sub-regions in a country, the parameter is omitted from the call.

SELECT * FROM holidays.canada('ON', 2020, 2020);

The query will return the results:

datestamp       description                authority      day_off      observation_shifted   start_time   end_time        
[DATE]          [TEXT]                     [ENUM]         [BOOLEAN]    [BOOLEAN]             [TIME]       [TIME]
------------    -----------------------    -----------    ---------    -------------------   ----------   ----------
"2020-01-01"	"New Year's Day"           "federal"       true        false                 "00:00:00"   "24:00:00"
"2020-02-17"	"Family Day"               "provincial"    true        false                 "00:00:00"   "24:00:00"
"2020-04-10"	"Good Friday"              "federal"       true        false                 "00:00:00"   "24:00:00"
"2020-05-18"	"Victoria Day"             "federal"       true        false                 "00:00:00"   "24:00:00"
"2020-07-01"	"Canada Day"               "federal"       true        false                 "00:00:00"   "24:00:00"
"2020-08-03"	"Civic Holiday"            "provincial"    true        false                 "00:00:00"   "24:00:00"
"2020-09-07"	"Labour Day"               "federal"       true        false                 "00:00:00"   "24:00:00"
"2020-11-11"	"Remembrance Day"          "federal"       true        false                 "00:00:00"   "24:00:00"
"2020-12-25"	"Christmas Day"            "federal"       true        false                 "00:00:00"   "24:00:00"
"2020-12-28"	"Boxing Day (Observed)"    "federal"       true        true                  "00:00:00"   "24:00:00"

A convienience "by country" function is also provided which accepts many name variations and defines a default region.

SELECT * FROM holidays.by_country('canada', 2020, 2020);

The above query would also produce the same output.

To Do

Cross-port the knowledge from the npm / javascript libraries for the same purpose. It uses a declarative method (which may be concurrently recorded here), implements periods, and covers additional countries:

  • https://github.com/commenthol/date-holidays-parser

Fill in missing information related to partial holidays, or non-holiday, but special dates:

  • https://www.timeanddate.com/holidays/

Feedback

I openly solicit pull requests and issues as feedback to make this package better. The port from Python was naive and I'm only intimately knowledgable about my own country's holidays (Canada). I expect many corrections and enhancements are necessary.

Ported From Credits / Attributions

  • Primary Code Sources
    • Python holidays
    • JavaScript date-holidays

About

Package to calculate holiday dates in PostgreSQL

Topics

chinesegregorianhijriholidaysjalalijulianorthodoxpostgresql

Resources

Readme
MIT license
Activity

Stars

35 stars

Watchers

1 watching

Forks

15 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.