Skip to main content

Checking what kind of time a date is.

Project description

whattime

PyPI version Build Status

Checking of what kind a datetime object is: it let’s you explore whether a certain datetime object is e.g. a Sunday morning in summer or a Wednesday night in winter. It also consideres hemispheres.

Getting started

Install it with:

pip install whattime

or

pipenv install whattime

For quickly getting started, just import the whattime function and explore a date’s properties (also see the Get started example):

from datetime import datetime
from whattime import whattime, Hemisphere

now = datetime.now()
info = whattime(now, Hemisphere.SOUTHERN)

info.is_weekday
info.is_monday
info.is_summer
# ...

Besides checking all the time types you can also only check a certain category of types, e.g. info about the current day, or the time within a day seperately (also see the Single info type example).

from datetime import datetime
from whattime import week_info, day_time_info, season_info, Hemisphere

now = datetime.now()

# There will only be properties available concerning the week time info when using week_info():
info = week_info(now)
info.is_weekday
info.is_monday
# ...

# There will only be properties available concerning the day time info when using day_time_info():
info = day_time_info(now)
info.is_afternoon
info.is_evening
# ...

# There will only be properties available concerning the season info when using season_info():
info = season_info(now, Hemisphere.SOUTHERN)
info.is_spring
info.is_summer
# ...

Development

  • Check out the repo with git clone git@github.com:grammofy/whattime.git.

  • To set up the project for development you need to install Pipenv and run:

    pipenv install --dev
    

    in order to install the needed development requirements.

  • Tests can be run with:

    python setup.py test
    

Contributing

Bug reports, feature discussions and pull requests are welcome on GitHub at https://github.com/grammofy/whattime. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant Code of Conduct.

Here’s how to contribute:

  • Fork it (https://github.com/grammofy/whattime/fork)
  • Create your feature branch (git checkout -b feature/my-new-feature master)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin feature/my-new-feature)
  • Create a new Pull Request

Please try to add Pytest tests along with your new feature. This will ensure that your code does not break existing functionality and that your feature is working as expected.

License

The software is available as open source under the terms of the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whattime-0.2.0.tar.gz (28.8 kB view details)

Uploaded Source

File details

Details for the file whattime-0.2.0.tar.gz.

File metadata

  • Download URL: whattime-0.2.0.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for whattime-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c5afce6441217f076344a86463de465b4abee170b015308ddded9fe38a0a7b09
MD5 64d09c56f06b503b75f94ad9f78f3b40
BLAKE2b-256 812749b35052605fb88d9d30ffa7d26ca82adf2a7b498adf65f6d0f457d5d226

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page