hydroshare: Python strftime can't handle dates before 1900
A user has tried to upload data with a legitimate start date of 1890.
However, when trying to upload it into HydroShare, they were met with the following error:
temporal_coverage_data_dict['start_date'] = start_date.strftime('%Y-%m-%d')
ValueError: year=1890 is before 1900; the datetime strftime() methods require year >= 1900
It looks like there are numerous options to fix this.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 28 (25 by maintainers)
Commits related to this issue
- [#2777] - pep8 blank lines — committed to hydroshare/hydroshare by sblack-usu 5 years ago
- #2777 handling dates below 1900 — committed to hydroshare/hydroshare by deleted user 5 years ago
- Fixes #2777 — committed to hydroshare/hydroshare by deleted user 5 years ago
- Merge pull request #3340 from hydroshare/handling_date Fixes #2777 — committed to hydroshare/hydroshare by deleted user 5 years ago
- Revert "Fixes #2777" This reverts commit 71ec93eb561475491cc953dd3e2beee1fc28751f. — committed to hydroshare/hydroshare by deleted user 5 years ago
- Merge pull request #3343 from hydroshare/revert-datefix Revert "Fixes #2777" — committed to hydroshare/hydroshare by deleted user 5 years ago
So, perhaps, a function like this would be useful.
I will buy everybody on the team a round of drinks at whatever conference we are all next at if and when HydroShare gets updated to Python 3.
Fwiw, 7/16/18 is pretty clear, but mm/dd/yy can be ambiguous. Europeans and military folks often interpret numeric dates like 7/4/18 as April 7 not July 4. It’s least ambiguous & most general to stick with yyyy-mm-dd or spell out the month abbreviation.
That’s a clever function. It self documents how to do custom formatting while defaulting to a standard format. 👍
I’d argue it is probably a good idea to standardize date format across the board in HydroShare.