A datetime parser in Python by Ari24-cb24 and NekoFantic

Overview

datetimeparser

A datetime parser in Python by Ari24-cb24 and NekoFantic

V 1.0

Erinnerung für den Parser

  • Auf falsche Eingaben überprüfen

Liste an Events

  • christmas
+ Year configurable

When: 24.12.YYYY

Alias:
- next christmas
- xmas
- next xmas
  • silvester
+ Year configurable

When: 31.12.YYYY

Alias:
- next silvester
- new years eve
- next new years eve
  • eastern
+ Year configurable

When: 
   .04.YYYY

Alias:

   - easter

   - next eastern

   - next easter
  
  • nicholas
+ Year configurable

When: 05.12.YYYY

Alias:
- next nicholas
- nicholas day
- next nicholas day

Ideen für Datenarchitektur vom Parser zum Evaluator

. week of fifth week of august 1. week of august 1st week of august 2st week of year 2023 1 day after 2025 3 days before august [RelativeMonth(3), Keyword.BEFORE, RelativeWeek(5), Keyword.OF, AbsoluteMonth.AUGUST] 3 months before the fifth week of august of after before [Constant.CHRISTMAS, AbsoluteDateTime(year=2040)] events (christmas/birth jesus christus, silvester/new years eve, etc) # Spezifische Zeit kann noch optional angegeben werden, falls beim Event noch nicht eine solche Zeit definiert wurde # vor dem Event darf eine Präposition stehen, dann gilt die Kombination aus als Alias für das Event [Constant.TOMORROW] tomorrow ================================= Relatives: # Keywords: 'next', 'in', 'for' [RelativeDate(year=1, month=2, weeks=3, days=4), RelativeTime(hours=5, minutes=6, seconds=7)] in 1Y 2m 3W 4d 5H 6M 7S in 1 Year(s) 2 Month(s) 2 Week(s) 4 Day(s) 5 Hour(s) 6 Minute(s) 7 Second(s) in a year in 2 months in a week in a hour in 6 min 2 sec for 1 year [RelativeWeekDay.FRIDAY] next xyDay .ban @user next year and 2 months .ban @user next 1 year .ban @user next a year Die Zeitangabe, welche nach der Präposition (in, next) kommt, braucht, wenn die Zeitangabe nur ein einzelnes ist, keine Angabe der Zeit (Siehe Beispiele mit ban) Für Idioten gesagt: Zeitangabe nach next oder in braucht keine Zahl oder ein `a` """ ">
"""
Absolutes:

[AbsoluteDateTime(year=2020, month=3, day=2)]
[AbsoluteClockTime(hour=3, minute=2, second=1)]
yyyy.mm.dd hh:mm:ss
dd.mm.yyyy hh:mm:ss
hh:mm:ss
dd.mm.yyyy

# Präpositionen: 'Of', 'After', 'Before'
# Rule: first - tenth (nicht weiter gehen)
[RelativeDate(week=3), RelativeTime(), keyword.OF, AbsoluteDateTime(year=2016)]
3rd week of (year) 2016
3rd of august
<1-5>. week of 
              
fifth week of august
1. week of august
1st week of august
2st week of year 2023
1 day after 2025
3 days before august

[RelativeMonth(3), Keyword.BEFORE, RelativeWeek(5), Keyword.OF, AbsoluteMonth.AUGUST]

3 months before the fifth week of august

              
                of 
               
              

              
                after 
               
              

              
                before 
               
              

[Constant.CHRISTMAS, AbsoluteDateTime(year=2040)]
events (christmas/birth jesus christus, silvester/new years eve, etc)

               
               
              

# Spezifische Zeit kann noch optional angegeben werden, falls beim Event noch nicht eine solche Zeit definiert wurde
# vor dem Event darf eine Präposition stehen, dann gilt die Kombination aus 
               
               
                 als Alias für das Event
               
              

[Constant.TOMORROW]
tomorrow


=================================

Relatives:

# Keywords: 'next', 'in', 'for'

[RelativeDate(year=1, month=2, weeks=3, days=4), RelativeTime(hours=5, minutes=6, seconds=7)]
in 1Y 2m 3W 4d 5H 6M 7S
in 1 Year(s) 2 Month(s) 2 Week(s) 4 Day(s) 5 Hour(s) 6 Minute(s) 7 Second(s)
in a year in 2 months in a week in a hour
in 6 min 2 sec
for 1 year

[RelativeWeekDay.FRIDAY]
next xyDay


.ban @user next year and 2 months
.ban @user next 1 year
.ban @user next a year

Die Zeitangabe, welche nach der Präposition (in, next) kommt, braucht, wenn die Zeitangabe nur ein einzelnes ist, keine Angabe der Zeit (Siehe Beispiele mit ban)
Für Idioten gesagt: Zeitangabe nach next oder in braucht keine Zahl oder ein `a`

"""
Comments
  • [General Issue] Change infinity value to

    [General Issue] Change infinity value to "today in 200 years"

    Describe your issue here

    Infinity currently returns -1

    Because of the lack of consistency in the return type, a datetime.datetime with the value "today in 200 years" should be returned.

    question 
    opened by Ari24-cb24 4
  • [New Constant] half an hour in relative times

    [New Constant] half an hour in relative times

    List of new constants/events

    • [x] half of an hour
    • [x] half an hour
    • [x] quarter after an hour
    • [x] two quarters before an hour
    • [x] quarter an hour
    • [x] three quarter
    • [x] two quarter
    • [x] one quarter

    Example usecase

    in 2 hours and quarter an hour

    parser evaluator 
    opened by Ari24-cb24 3
  • Add more Eventes

    Add more Eventes

    Here are some ideas for events to add

    • [x] Beginning of Advent of Code
    • [x] End of Advent of Code
    • [x] Beginning/End of Summer/Spring/Fall/Winter
    • [x] April Fool's Day
    • [x] Thanksgiving
    • [ ] (Independence Day)
    • [ ] Black Friday
    • [ ] Cyber Monday
    new constant/event 
    opened by leon-3 3
  • fix packages in `setup.*`

    fix packages in `setup.*`

    Description about the changes

    Automate package-finding for installation (installation is incomplete if setup.py is not manually updated)

    Python Version you tested this feature on

    • [ ] Python 3.7
    • [ ] Python 3.8
    • [ ] Python 3.9
    • [x] Python 3.10
    • [ ] Python 3.11
    opened by AlbertUnruh 2
  • [Bug in Parsing] Year needs four digits

    [Bug in Parsing] Year needs four digits

    Given input

    1. 20.2.0791

    2. 20.2.791

    Expected output

    1. 20-2-0791 0:00:00 (datetime)

    2. 20-2-0791 0:00:00 (datetime)

    Actual given output

    1. 20-2-0791 0:00:00 (datetime)

    2. Parser returned None

    Some extra notes

    The parser can only handle years with 4 digits, but these digits can be 0 too.

    bug parser 
    opened by Inf-inity 2
  • retrieve `__version__` via regex (fixes #200)

    retrieve `__version__` via regex (fixes #200)

    make __version__ being retrieved via regex inside setup.py to avoid imports of requirements (which aren't installed at the moment of execution)

    fixes #200

    opened by AlbertUnruh 1
  • Constant evaluation based on coordinates and timezone

    Constant evaluation based on coordinates and timezone

    Description about the changes

    • added formula for calculating sunrise / sunset for given coordinates
    • added option to parse function for setting coordinates, overwriting the timezone given, calculating its own, using the timezonefinder module
    • made sunrise and sunset enums independent
    • added Result object

    Testcases that have been added

    • next constant: None

    Constants that have been added

    • constant: datetime(...)

    Python Version you tested this feature on

    • [ ] Python 3.7
    • [ ] Python 3.8
    • [ ] Python 3.9
    • [X] Python 3.10
    • [ ] Python 3.11
    evaluator 
    opened by Inf-inity 1
  • Fixed matrix strategy failing-fast

    Fixed matrix strategy failing-fast

    opened by Ari24-cb24 1
  • Evaluator/bugfixes

    Evaluator/bugfixes

    Description about the changes

    Fixed failing testcases

    Testcases that have been added

    None

    Constants that have been added

    None

    Python Version you tested this feature on

    • [ ] Python 3.7
    • [ ] Python 3.8
    • [ ] Python 3.9
    • [X] Python 3.10
    • [ ] Python 3.11
    opened by Inf-inity 1
  • Added `Expected` object for Testcases

    Added `Expected` object for Testcases

    Description about the changes

    • Created Expected object for building testcases more easily

    Python Version you tested this feature on

    • [ ] Python 3.7
    • [ ] Python 3.8
    • [ ] Python 3.9
    • [X] Python 3.10
    • [ ] Python 3.11
    opened by Inf-inity 1
  • Absolute Preposition Parser does now parse absolute datetime formats

    Absolute Preposition Parser does now parse absolute datetime formats

    Description about the changes

    Closes #158

    • The absolute preposition parser did not parse absolute datetime formats before (e.g. "(30 hours after) 30.03.2020"). This has now been fixed
    • Fixed style issues
    • Fixes the GitHub testrunner

    Testcases that have been added

    • 30 hours after 30.03.2020: datetime(year=2020, month=3, day=31, hour=4)

    Python Version you tested this feature on

    • [ ] Python 3.7
    • [ ] Python 3.8
    • [ ] Python 3.9
    • [x] Python 3.10
    • [ ] Python 3.11
    parser-grammar 
    opened by Ari24-cb24 1
  • [Bug in Parsing] Possible timezone parsing error with pytz library

    [Bug in Parsing] Possible timezone parsing error with pytz library

    Issue:

    The pytz library has been known to cause issues when used in conjunction with datetime.timezone. As this is often used by other libraries, it is recommended to use the built-in zoneinfo library instead, which does not have these issues.

    Important Note:

    If you are using zoneinfo on a Windows machine, be sure to also install tzdata to ensure proper functioning.

    Further information:

    • https://docs.python.org/3/library/zoneinfo.html
    • https://pypi.org/project/tzdata/
    evaluator 
    opened by qt-haskell 2
  • [Missing Parser grammar] First monday of august

    [Missing Parser grammar] First monday of august

    Given input

    • First monday of august

    Some extra notes

    Needs an extra parsing method.
    First <a> of <b>

    <a>: DatetimeConstant, WeekdayConstant and MonthConstant <b>: I think a mix of Absolute Preposition and Constants(extension)

    parser parser-grammar 
    opened by Ari24-cb24 3
  • [General Issue] Throw custom exceptions instead of returning None

    [General Issue] Throw custom exceptions instead of returning None

    Describe your issue here

    If the user input is not correct, datetimeparser returns None. As we want to provide more information about what was wrong, we're going to throw custom exceptions whenever we would normally return None.

    parser evaluator 
    opened by Ari24-cb24 0
  • [Missing Parser grammar] Absolute Time Constant Prepositions

    [Missing Parser grammar] Absolute Time Constant Prepositions

    Given input

    • [ ] 3 hours in the morning
    • [ ] 3 hours in the future
    • [ ] 3 hours in the past
    • [x] 3 hours before now
    • [x] 3 hours after now
    • [x] 3 hours before tomorrow
    • [x] 3 hours after tomorrow
    • [x] 3 hours before yesterday
    • [x] 3 hours after yesterday
    • [ ] 3 hours before tomorrow at 3pm
    • [ ] 3 hours after tomorrow at 3pm
    • [ ] 3 hours after tomorrow morning
    parser parser-grammar 
    opened by Ari24-cb24 0
Releases(v0.10.3)
  • v0.10.3(Mar 24, 2022)

    We fixed a lot of issues with grammar and worked in 5 issues 🚀

    What's Changed

    • Fixed max character limit in testbot by @Ari24-cb24 in https://github.com/aridevelopment-de/datetimeparser/pull/136
    • Fixed some bug in bot with max character limit by @Ari24-cb24 in https://github.com/aridevelopment-de/datetimeparser/pull/137
    • v0.6rc by @Ari24-cb24 in https://github.com/aridevelopment-de/datetimeparser/pull/138
    • Fixed garbage detection in absolute preposition by @Ari24-cb24 in https://github.com/aridevelopment-de/datetimeparser/pull/139
    • Added negative integer parsing by @Ari24-cb24 in https://github.com/aridevelopment-de/datetimeparser/pull/140
    • added more testcases and fixed some wrong enums by @NekoFanatic in https://github.com/aridevelopment-de/datetimeparser/pull/142
    • rewrote evaluator by @NekoFanatic in https://github.com/aridevelopment-de/datetimeparser/pull/143
    • added new constant "holy eve" by @NekoFanatic in https://github.com/aridevelopment-de/datetimeparser/pull/144
    • v0.8rc2: Added year type constants by @Ari24-cb24 in https://github.com/aridevelopment-de/datetimeparser/pull/145
    • Seperated GitHub workflows and updated README by @Ari24-cb24 in https://github.com/aridevelopment-de/datetimeparser/pull/147
    • v0.9rc1: Added grammar support for issue #78 by @Ari24-cb24 in https://github.com/aridevelopment-de/datetimeparser/pull/148
    • added new argument for Constants to give the utcoffset, important for… by @NekoFanatic in https://github.com/aridevelopment-de/datetimeparser/pull/149
    • Added pull request template by @Ari24-cb24 in https://github.com/aridevelopment-de/datetimeparser/pull/150
    • Added support for new Datetime Constants by @Ari24-cb24 in https://github.com/aridevelopment-de/datetimeparser/pull/151
    • Provieded dunder details by @Ari24-cb24 in https://github.com/aridevelopment-de/datetimeparser/pull/152

    Full Changelog: https://github.com/aridevelopment-de/datetimeparser/compare/v0.4rc...v0.10.3

    Source code(tar.gz)
    Source code(zip)
  • v0.4rc(Mar 14, 2022)

    What's Changed

    • Added DatetimeDelta Constant enum to Constant Parser by @Ari24-cb24 in https://github.com/aridevelopment-de/datetimeparser/pull/131
    • added missing evaluator grammar by @NekoFanatic in https://github.com/aridevelopment-de/datetimeparser/pull/134
    • Fixed critical recursion bug by @Ari24-cb24 in https://github.com/aridevelopment-de/datetimeparser/pull/135

    Full Changelog: https://github.com/aridevelopment-de/datetimeparser/compare/v0.2rc...v0.4rc

    Source code(tar.gz)
    Source code(zip)
  • v0.2rc(Mar 13, 2022)

    What's Changed

    • Fixed version number by @Ari24-cb24 in https://github.com/aridevelopment-de/datetimeparser/pull/130

    Full Changelog: https://github.com/aridevelopment-de/datetimeparser/compare/v0.1e...v0.2rc

    Source code(tar.gz)
    Source code(zip)
  • v0.1e(Mar 13, 2022)

  • v0.1d(Mar 13, 2022)

Owner
AriDevelopment
A place where multiple developers come together and create OSS
AriDevelopment
A simple in-process python scheduler library, designed to be integrated seamlessly with the `datetime` standard library.

scheduler A simple in-process python scheduler library, designed to be integrated seamlessly with the datetime standard library. Due to the support of

30 Dec 30, 2022
Datetimes for Humans™

Maya: Datetimes for Humans™ Datetimes are very frustrating to work with in Python, especially when dealing with different locales on different systems

Timo Furrer 3.4k Dec 28, 2022
Parse human-readable date/time strings

parsedatetime Parse human-readable date/time strings. Python 2.6 or greater is required for parsedatetime version 1.0 or greater. While we still test

Mike Taylor 651 Dec 23, 2022
Generate and work with holidays in Python

python-holidays A fast, efficient Python library for generating country, province and state specific sets of holidays on the fly. It aims to make dete

Maurizio Montel 881 Dec 29, 2022
UNIX time from NTP or short UtfN is a simple CLI tool to set the time from an NTP-Server.

UNIX ⌚ from NTP UNIX time from NTP or short UtfN is a simple CLI tool to set the time from an NTP-Server. Sets time and date using the date command pr

Alexander 1 Jan 02, 2022
Python datetimes made easy

Pendulum Python datetimes made easy. Supports Python 2.7 and 3.4+. import pendulum now_in_paris = pendulum.now('Europe/Paris') now_in_par

Sébastien Eustace 5.3k Jan 06, 2023
darts is a Python library for easy manipulation and forecasting of time series.

A python library for easy manipulation and forecasting of time series.

Unit8 5.2k Jan 01, 2023
A Python library for dealing with dates

moment A Python library for dealing with dates/times. Inspired by Moment.js and Kenneth Reitz's Requests library. Ideas were also taken from the Times

Zach Williams 709 Dec 09, 2022
🏹 Better dates & times for Python

Arrow: Better dates & times for Python Arrow is a Python library that offers a sensible and human-friendly approach to creating, manipulating, formatt

Arrow 8.2k Jan 09, 2023
ISO 8601 date/time parser

ISO 8601 date/time parser This module implements ISO 8601 date, time and duration parsing. The implementation follows ISO8601:2004 standard, and imple

118 Dec 20, 2022
The Terasic DECA board as a mandelbrot acceleerator

deca-mandelbrot The Terasic DECA board as a mandelbrot accelerator. This is a hobby project to explore parallel computation/pipelining on a FPGA. curr

Hans Baier 11 Aug 29, 2022
A Python 3 library for parsing human-written times and dates

Chronyk A small Python 3 library containing some handy tools for handling time, especially when it comes to interfacing with those pesky humans. Featu

Felix Wiegand 339 Dec 19, 2022
Friendly Python Dates

When.py: Friendly Dates and Times Production: Development: User-friendly functions to help perform common date and time actions. Usage To get the syst

Andy Dirnberger 191 Oct 14, 2022
Better dates & times for Python

Arrow: Better dates & times for Python Arrow is a Python library that offers a sensible and human-friendly approach to creating, manipulating, formatt

Arrow 8.2k Jan 05, 2023
Croniter provides iteration for the datetime object with a cron like format

Introduction Contents Introduction Travis badge Usage About DST About second repeats Testing if a date matches a crontab Gaps between date matches Ite

kiorky 152 Dec 30, 2022
Delorean: Time Travel Made Easy

Delorean: Time Travel Made Easy Delorean is a library for clearing up the inconvenient truths that arise dealing with datetimes in Python. Understandi

Mahdi Yusuf 1.8k Dec 20, 2022
⌚️Internet Time reference and (eventually) converter site, for planning things with your internet friends who aren't (yet) obsessed with Internet Time 😉

Internet-Ti.me Internet Time reference and (eventually) converter site, for planning things with your internet friends who aren't (yet) obsessed with

Jessica Stokes 17 Nov 02, 2022
A simple digital clock made with the help of python

Digital-Clock ⏰ Description 📚 ✔️ A simple digital clock made with the help of python. The code is easy to understand and implement. With this reposit

Mohit 0 Dec 10, 2021
A datetime parser in Python by Ari24-cb24 and NekoFantic

datetimeparser A datetime parser in Python by Ari24-cb24 and NekoFantic V 1.0 Erinnerung für den Parser Auf falsche Eingaben überprüfen Liste an Event

AriDevelopment 13 Dec 30, 2022
E-Ink Magic Calendar that automatically syncs to Google Calendar and runs off a battery powered Raspberry Pi Zero

E-Ink Magic Calendar that automatically syncs to Google Calendar and runs off a battery powered Raspberry Pi Zero

2.8k Jan 06, 2023