std.dateparse reincarnation

Stewart Gordon smjg_1998 at yahoo.com
Tue Oct 25 13:10:54 PDT 2011


On 13/10/2011 05:22, Jesse Phillips wrote:
> Thought I would let everyone know that while std.dateparse is deprecated
> and will be removed from Phobos in February, I've updated it to output a
> std.datetime.SysTime.
>
> https://gist.github.com/1283011
>
> I don't have any interest in maintaining it, but since I did use it I
> updated it for me.

The locale detection is broken, as this example shows.

----- dateparse_test.d -----
import dateparse, std.cstream, std.datetime;

void main() {
	string s;
	while ((s = din.readLine().idup) != "") {
		SysTime t;
		dateParse(s, t);
		dout.writefln("%s", t);
	}
}
----- output -----
C:\Users\Stewart\Documents\Programming\D\thirdp>dateparse_test
12/10/2011
2011-Dec-10 00:00:00
29/10/2011
dateparse.DateParseException at dateparse.d(35): Invalid date string: 29/10/2011
----------------
46B4A8
46B31F
402145
402085
403300
40333F
402F3B
49E6F9
49E650
----------------
----------

Stewart.


More information about the Digitalmars-d-announce mailing list