bear/parsedatetime
bear/parsedatetime has 710 GitHub stars and 116 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-23 19:58 UTC. Last push 2026-11-20.
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
소개
Parse human-readable date/time strings
개발 도구README.md
Originalparsedatetime
Parse human-readable date/time strings.
Parsedatetime now targets Python 3 and is currently tested with Python 3.9
Use https://github.com/bear/parsedatetime/releases/tag/v2.6 if you need Python 2.7 compatibility.
Installing
You can install parsedatetime using
pip install parsedatetime
Development environment
Development is done using a pipenv virtual environment
make env
Note: black is still listed as a beta library, and as such, must be installed with the --pre flag
Running Tests
From the source directory
make test
To run tests on several Python versions that are installed in the pipenv virtual environment
$ make tox
[... tox creates a virtualenv for every python version and runs tests inside of each]
py39: commands succeeded
The tests depend on PyICU being installed using the pyicu-binary package which removes the source build step. PyICU depends on icu4c which on macOS requires homebrew
brew install icu4c
Using parsedatetime
Detailed examples can be found in the examples directory.
as a time tuple
import parsedatetime
cal = parsedatetime.Calendar()
cal.parse("tomorrow")
as a Python datetime object
from datetime import datetime
time_struct, parse_status = cal.parse("tomorrow")
datetime(*time_struct[:6])
with timezone support using pytz
import parsedatetime
from pytz import timezone
cal = parsedatetime.Calendar()
datetime_obj, _ = cal.parseDT(datetimeString="tomorrow", tzinfo=timezone("US/Pacific"))
Documentation
The generated documentation is included by default in the docs directory and can also be viewed online at https://bear.im/code/parsedatetime/docs/index.html
The documentation is generated with
make docs
Notes
The Calendar class has a member property named ptc which is created during the class init method to be an instance of parsedatetime_consts.CalendarConstants().
History
The code in parsedatetime has been implemented over the years in many different languages (C, Clipper, Delphi) as part of different custom/proprietary systems I've worked on. Sadly the previous code is not "open" in any sense of that word.
When I went to work for Open Source Applications Foundation and realized that the Chandler project could benefit from my experience with parsing of date/time text I decided to start from scratch and implement the code using Python and make it truly open.
After working on the initial concept and creating something that could be shown to the Chandler folks, the code has now evolved to its current state with the help of the Chandler folks, most especially Darshana.
관련 프로젝트 살펴보기
불러오는 중…