Skip to content

Conversation

@scafoglieri
Copy link

@scafoglieri scafoglieri commented Feb 9, 2018

Hi,
the Go function time.Date() have the normalization feature "built-in", so with incorrect input (like 31/04/2018 or 32/02/2018) we get a date, but not the expected one. Since the time.Date() function does not return any error, this behaviour can be acceptable. But in your library (https://github.com/rickb777/date) the ParseISO() function return an error and so I prefer to get just an error instead of a wrong (but well formatted) result with the previous inputs.

So, just in case this is useful even to others, we can get an error in ParseISO() adding (in file parse.go line 149):

	_, err = time.Parse("2006-01-02", abs[:dash1] + "-" + abs[fm1:fm2] + "-" + abs[fd1:])
	if err != nil {
		return Date{}, err
	}

	t := time.Date(year, time.Month(month), day, 0, 0, 0, 0, time.UTC)

Thanks
Michele

Rick added 30 commits November 23, 2015 23:15
… e.g. "1st", "2nd", "3rd", "4th". This can be translated to other locales.
…ally int32) instead of a struct. This makes iterating over a date range easier.
…nsequence. Some bugs fixed relating to Last() and End() (formerly called End() and Next()).
…al and economical space for the anticipated usage. Added interfacing to time.Duration and time.Time.
rickb777 and others added 28 commits September 4, 2020 21:06
Signed-off-by: Tamal Saha <tamal@appscode.com>
Add flag methods to Period
…n be represented as a blank string and the tag 'omitempty' can now work.
…string, which might raise difficulties are the receiver. Code that relied on this incorrect behaviour might see this as a breaking change.
@rickb777 rickb777 deleted the branch fxtlabs:master September 22, 2023 10:23
@rickb777 rickb777 deleted the master branch September 22, 2023 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants