question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Get date by holiday string

See original GitHub issue

Hello! I feel like this is a dumb question but am just not seeing anything about it in the readme.

Is there a method that supports something like us_holidays.get('Thanksgiving')?

For example if I wanted to add the day after Thanksgiving to my custom calendar, I will need to first get that holiday, which feels like an odd thing to do manually with a library that handles holidays -

class MyCal(holidays.UnitedStates):
    def _populate(self, year):
        holidays.UnitedStates._populate(self, year)
        # Add Friday after Thanksgiving
        thanksgiving = date(year, 11, 1) + rd(weekday=TH(+4))
        thanksgiving_friday = thanksgiving + rd(days=1)
        self[thanksgiving_friday] = 'Thanksgiving Friday'

(this is just an example, I know I can get the day other ways)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dr-prodigycommented, Jul 6, 2020

@samtregar Glad to be helping! Sorry for getting there a little late, but better late than never… 😃

1reaction
dr-prodigycommented, Jul 6, 2020

Hi, thank you for your interest in holidays library. I’ve added get_named(key) method, receiving a complete or partial string, which will be checked against all currently available holidays (ie: depending on initialization), applying a case insensitive match. Results are returned in a list containing all matched dates.

Pushed on beta branch, thank you again, cheers! dr-p

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get the holidays date in my case? - Stack Overflow
I made your original list of holiday dates into an array called holidays . The holiday variable on the line with the forEach...
Read more >
date-holidays-parser/Holidays.md at master - GitHub
get all holidays for year with names using preferred language. Parameters. year: String | Date , if omitted, the current year is chosen....
Read more >
5 Minute Guide to Detecting Holidays in Python
It allows you to get dates and names of major holidays for specific year(s) and for a specific country. You might be wondering...
Read more >
Referencing Holiday String in a formula - Airtable Community
Solved: Hi! I'm working on setting up a long-running {Task Due} date formula field that will eventually span across multiple years.
Read more >
String to Date? - Piston: Design Help
just to state the obvious, :smiley: with known holiday dates from that URL, you could find each dates 'F E M' format and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found