Code Monkey home page Code Monkey logo

holiday_jp-python's Introduction

PyPI version PyPI downloads GitHub release

holiday_jp-python

Japanese holiday for Python 3+ using dataset from https://github.com/holiday-jp/holiday_jp

install

pip3 install holiday-jp

If you want to contribute

Build on linux with python 3.x

Clone the project or download the source

git clone https://github.com/holiday-jp/holiday_jp-python

test

python3 -m unittest holiday_jp.test

OR

make test

Build command:

python3 setup.py sdist

OR

make build

It will build the package and be available in the dist/ directory

alternative install

download the release and install this way: pip3 install holiday_jp-xxx.tar.gz

Usage

from holiday_jp import HolidayJp
# with string date YYYY-MM-DD
if HolidayJp('1990-01-01').is_holiday:
  print('True')

import datetime
from holiday_jp import HolidayJp
# or date object
if HolidayJp(datetime.date.today()).is_holiday:
  print('False')
else:
  print('True')

# Between return holidays between 2 dates in text
holidays = HolidayJp.between('2009-01-01', '2009-01-31')
new_year_day = holidays[0]
self.assertEqual(datetime.date(year=2009, month=1, day=1), new_year_day.date_obj)
self.assertEqual('元日', new_year_day.name)

# Or date object
holidays = HolidayJp.between(datetime.date(year=2008, month=12, day=23), datetime.date(year=2009, month=1, day=12))

For more usage check the unit test holiday_jp/test.py

holiday_jp-python's People

Contributors

gabriel-tessier avatar bry-c avatar dependabot-preview[bot] avatar 4geru avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.