{"id":22001697,"url":"https://github.com/panodata/aika","last_synced_at":"2025-10-04T17:15:01.514Z","repository":{"id":190177645,"uuid":"682101418","full_name":"panodata/aika","owner":"panodata","description":"Time interval parsing utilities for multiple languages.","archived":false,"fork":false,"pushed_at":"2025-03-18T21:07:34.000Z","size":72,"stargazers_count":3,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T21:13:55.225Z","etag":null,"topics":["datetime-format","datetime-inputs","datetime-library","datetime-parser","datetime-parsing","dwim","human-computer-interaction","humanized-tech","kotori-daq"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/panodata.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-23T12:51:00.000Z","updated_at":"2025-03-18T21:07:29.000Z","dependencies_parsed_at":"2023-10-01T21:56:03.479Z","dependency_job_id":"5b27c1c9-9349-4257-8a83-14af441c08a0","html_url":"https://github.com/panodata/aika","commit_stats":null,"previous_names":["panodata/aika"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panodata%2Faika","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panodata%2Faika/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panodata%2Faika/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panodata%2Faika/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/panodata","download_url":"https://codeload.github.com/panodata/aika/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251864111,"owners_count":21656288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datetime-format","datetime-inputs","datetime-library","datetime-parser","datetime-parsing","dwim","human-computer-interaction","humanized-tech","kotori-daq"],"created_at":"2024-11-29T23:14:44.152Z","updated_at":"2025-10-04T17:14:56.448Z","avatar_url":"https://github.com/panodata.png","language":"Python","readme":"# Aika\n\nTime interval parsing utilities for multiple languages.\n\n## About\n\nAika provides date- and time-range parsing utilities for multiple languages.\nIt is based on [dateparser], [arbitrary-dateparser], and [DateRangeParser],\nand aims for [DWIM]-like convenience and usefulness.\n\nCurrently, it supports 200 language locales through `dateparser`, and more\nspecific support for English and German through `arbitrary-dateparser`.\nContributions for other languages are welcome.\n\n\n## Setup\n\nInstall the most recent version of Aika.\n```shell\npip install --upgrade aika\n```\n\n\n## Usage\n\n```doctest\n\u003e\u003e\u003e import datetime as dt\n\u003e\u003e\u003e from aika import TimeIntervalParser\n\u003e\u003e\u003e \n\u003e\u003e\u003e ti = TimeIntervalParser()\n\u003e\u003e\u003e\n\u003e\u003e\u003e ti.parse(\"Sat - Tue\")\n\u003e\u003e\u003e (dt.datetime(2023, 8, 26, 0, 0), dt.datetime(2023, 8, 29, 23, 59, 59, 999999))\n\u003e\u003e\u003e\n\u003e\u003e\u003e ti.parse_single(\"1. Juli\")\n\u003e\u003e\u003e dt.datetime(2023, 7, 1, 0, 0)\n```\n\n\n### Example Expressions\n\nAika understands all types of date-/time-range expressions like provided by the\npackages it is based upon, and works with single dates too. This section enumerates\na few examples.\n\n#### dateparser\n\n##### Calendar notations\n- Week: 2025W01\n- Month: 2025M02, 2025-02\n- Quarter: 2025Q03\n- Year: 2025\n\n##### Time deltas\n- Day: `-1d`, `-1 day`\n- Week: `-1w`, `-1 week`\n- Month: `-1M`, `-1 month`\n- Year: `-1y`, `-1 year`\n- Quarter: `-3M`, `-3 months`\n- Mixed: `-3d3h5m30s`\n\n#### arbitrary-dateparser » English\n\n- now\n- today\n- last week to next friday\n- tomorrow - next week\n- next month\n- december\n- July to December\n- jul 1 to jul 7\n- Sat - Tue\n- in March\n- 2024-08-20\n\n#### arbitrary-dateparser » German\n\n- jetzt\n- heute\n- letzte woche bis nächsten freitag\n- morgen - nächste woche\n- nächster monat\n- dezember\n- Juli-Dezember\n- jul 1 to jul 7\n- von Samstag bis Dienstag\n- im März\n- 20\\. August 2024\n- 20.8.2024\n- 20.08.2024\n\n#### DateRangeParser » English\n\n- 1st july\n- March 2024\n- July to December\n- 27th-29th June 2010\n- 30 May to 9th Aug\n- 3rd Jan 1980 -- 2nd Jan 2013\n- Wed 23 Jan -\u003e Sat 16 February 2013\n- Tuesday 29 May - Sat 2 June 2012\n- From 1 to 9 Jul\n- jul 1 to jul 9\n- 14th July 1988\n- Jan 2011 - Mar 2014 \n- 07:00 Tue 7th June - 17th July 3:30pm\n  \u003cbr\u003e**Caveat**: Times will currently be ignored.\n\n#### DateRangeParser » German\n\n- 1\\. Juli\n- 1\\. bis 7. Juli\n- März 2024\n- Juli bis Dezember\n- Vom 3. März bis zum 9. März 2024\n\n\n## Advanced Usage\n\nBy specifying `default_start_time` and `default_end_time` arguments, the\ndaterange boundaries will snap to the given times when they otherwise would be\n\"beginning of day\" (00:00) or \"end of day\" (23:59).\n\n```python\nimport datetime as dt\nfrom aika import TimeIntervalParser\n\ndr = TimeIntervalParser(\n    snap_hours=True,\n    default_start_time=dt.time(hour=9),\n    default_end_time=dt.time(hour=17),\n)\ndr.parse(\"Sat - Tue\")\n```\n```python\n(datetime(2023, 8, 26, 9, 0), datetime(2023, 8, 29, 17, 0))\n```\n\n\n## Troubleshooting\n\nIf you see an error message like `locale.Error: unsupported locale setting` for\ncode like this,\n```python\nimport locale\n\nlocale.setlocale(locale.LC_ALL, \"de_DE.UTF-8\")\n```\n\nyou will need to generate the German locales.\n```shell\napt-get update\napt-get install --yes tzdata locales\nlocale-gen de_DE.UTF-8\n```\n\n\n## Development\n\nAcquire source code and install development sandbox.\n```shell\ngit clone https://github.com/panodata/aika\ncd aika\nuv venv --seed --python 3.11\nsource .venv/bin/activate\nuv pip install --editable='.[develop,docs,test]'\n```\n\nRun linters and software tests:\n```shell\nsource .venv/bin/activate\npoe check\n```\n\n\n## Etymology\n\nAika means \"time\" in the Finnish language.\n\n## Acknowledgements\n\n- [Elias Dorneles] and contributors for conceiving and maintaining [dateparser].\n- [Michael Phelps] for conceiving [arbitrary-dateparser].\n- [Robin Wilson] and contributors for conceiving and maintaining [DateRangeParser].\n\n\n[arbitrary-dateparser]: https://pypi.org/project/arbitrary-dateparser/\n[dateparser]: https://pypi.org/project/dateparser/\n[DateRangeParser]: https://pypi.org/project/DateRangeParser/\n[DWIM]: https://en.wikipedia.org/wiki/DWIM\n[Elias Dorneles]: https://github.com/eliasdorneles\n[Michael Phelps]: https://github.com/nottheswimmer\n[Robin Wilson]: https://github.com/robintw\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanodata%2Faika","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpanodata%2Faika","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanodata%2Faika/lists"}