[Issue 20038] New: __DATE__ is in the wrong format for std.datetime.Date.from*

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 9 09:15:29 UTC 2019


          Issue ID: 20038
           Summary: __DATE__ is in the wrong format for
           Product: D
           Version: D2
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: jurily at gmail.com

I wanted to reproduce a Webpack feature of not working on Monday. I feel this
should be enough:

int main(string[]) {
        import std.datetime;
        static assert(Date.fromSimpleString(__DATE__).dayOfWeek !=
        return 0;

Instead there's an error:

$ rdmd scratch.d
Error: uncaught CTFE exception core.time.TimeException("Invalid string format:
Jul  9 2019"c)
scratch.d(3):        called from here: fromSimpleString("Jul  9 2019")
scratch.d(3):        while evaluating: static
assert(cast(int)fromSimpleString("Jul  9 2019").dayOfWeek() != 1)
Failed: ["/data/data/com.termux/files/usr/bin/ldmd2", "-v", "-o-", "scratch.d",


More information about the Digitalmars-d-bugs mailing list