datestr2num of year and month fails on 29th, 30th, and 31st of month #2481
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
datestr2num by default uses the current day if year-month data is converted.
This means that on the 29th, 30th or 31st of any month, datestr2num cannot be used to convert February, and on the 31st of any month, a number of other months cannot be converted.
For example, on September 30 I cannot convert monthly data, as February doesn't have 30 days. Conversion of:
datestr2num('2000-02')
Gives an error:
ValueError: day is out of range for month
datestr2num calls dateutil.parser.parse, which by default uses the
current date at 00:00:00 for missing fields. The dateutil function
also can use a "default" argument to change this bahavoir but it is
not available in datestr2num. datestr2num needs a keyword argument to change the day that is used when it is not supplied.