From frederik at ofb.net  Tue Jan 17 03:20:58 2017
From: frederik at ofb.net (frederik at ofb.net)
Date: Mon, 16 Jan 2017 18:20:58 -0800
Subject: [Rd] strptime("1","%m") returns NA
In-Reply-To: <20170111014855.GI29294@ofb.net>
References: <20170111014855.GI29294@ofb.net>
Message-ID: <20170117022058.GB29294@ofb.net>

Hi R Devel,

I wrote some code which depends on 'strptime' being able to parse an
incomplete date, like this:

> base::strptime("2016","%Y")
[1] "2016-01-14 PST"

The above works - although it's odd that it gives the month and day
for Sys.time(). I might expect it to set them both to zero as the GNU
libc strptime does on my system, or to use January 1 which would also
be reasonable.

When I specify the month, however, I get NA:

> base::strptime("2016-12","%Y-%m")
[1] NA
> base::strptime("1", "%m")
[1] NA

Any reason for this to be the case?

I reported a bug here:

https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17212

but I don't think I'm getting emails from Bugzilla so maybe best to
ping me if anyone replies there instead.

I've just written a simple reimplementation of 'strptime' for my own
use; I hope this bug report may be useful to others.

Thank you,

Frederick



[Rd] strptime("1","%m") returns NA
frederik at ofb.net