There is what I would call a bug in date_parse when there is no day. $d = date_parse("Feb 2010")
will give $d["day"] == 1
.
See the comment on this on the date_parse manual page.
Any nice workaround for this problem? :-)
UPDATE The date comes from published research reports. Unfortunately this means that they could look in different ways. I want to convert them to more standard ISO format when displaying the references. To help the readers I want always to include just the given fields (years, month, date). So this should be valid (and just give me the year):
2010
This should be valid, but just give me 2010-02 so to say:
Feb 2010
UPDATE 2
So far I have seen two bugs here in date_parse
. It can't parse 2010
. And it gives a day though there is no day in Feb 2010
.
I can of course write a fix for this, but surely someone has already done this, or???
No answers so I answer my own question. Here is a workaround the problems I saw.
Some tests (visual ;-) )