shinux / pytime Goto Github PK
View Code? Open in Web Editor NEWPyTime is an easy-use Python module which aims to operate date/time/datetime by string.
License: MIT License
PyTime is an easy-use Python module which aims to operate date/time/datetime by string.
License: MIT License
Hi @shinux .
First of all, very nice module. Lot of handy methods to use for date and time manipulation.
I know last commit was years ago, but I would like to fix some things because I find this module useful and really easy to read. Also, it would be my first contribution to open source.
Here is what I found digging through PyTime, first some minor mistakes:
filter.py
, in method from_str
, there is typo at last line, raise CanNotFormatError('Not well formated. Expecting something like May,21st.2015')
. formated should be formattedfilter.py
, at if __name__ == '__main__':
, there is PEP 8 violation. PEP 8: expected 2 blank lines after class or function definition, found 1
. Missing one more blank linewipe
is not documented.Now second list may or may not be problems, you decide.
test_normal.py
, in method test_function
, this7
and this8
fail. On my machine, I setup this so it can show test as your tested, +2h offset I guess. I think you wanted to get from pytime.yesterday(1432310400 + gmt8offset)
-> datetime.datetime(2015, 5, 22, 0, 0)
. And you get it, but you are comparing it to datetime.datetime(2015, 5, 22)
which returns false, because tuple comparison fails here. Similiar is for this8
.daysrange
to days_range
, newyear
to new_year
, christeve
to christ_eve
and lastday
to last_day
. That is because words should be split with underscore by conventions of python using snake case, and you already use that convention for this_week
, last_week
, next_month
and so on.filter.py
, in method __parse_not_only_str
, function
word usage in for loop is too broad term to be used. Maybe rename it to baseParser_function
. Found some problems with pycharm too. link hereThere are some other things, but I would like to change some of those mentioned above if you would allow me to make pull request.
Thank you for your time.
Hey @shnode, do you have some plans of future features? I would like to help the project.
Thank you very much for checking my issue. I found that August was abbreviated as Agu instead of Aug when I used it, which made me very confused. I want to ask why this is?
example found in filter.py file:
NAMED_MONTHS = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4,
'May': 5, 'Jun': 6, 'Jul': 7, 'Agu': 8,
'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}
pytime.father(2020) gives me 2020-06-21
pytime.father(2021) gives me 2021-06-20
But for germany that day is on the 2020-05-21 / 2021-05-13.
Is there any way to get the fatherday for other countries?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.