97jaz / gregor

Date and time library for Racket
45 stars 10 forks source link

parse-date returns the wrong date #34

Closed mfelleisen closed 5 years ago

mfelleisen commented 5 years ago

This looks wrong to me:

> (parse-date "27.03.2020" "d.m.y")
#<date 2020-01-27>
97jaz commented 5 years ago

Hi Matthias, the pattern for months uses uppercase ‘M’s. Your example is using a minute pattern. What’s happening (though this is admittedly confusing) is that it’s parsing successfully parsing 3 minutes, but since you asked for a date (rather than a datetime), that doesn’t appear in the result. But the default value for the month (1) appears, since the pattern isn’t asking for a month.

mfelleisen commented 5 years ago

I thought I had copied this from the docs but I double-checked and I am wrong. Sorry for the bother, I'll close it.