Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__DATE__ is in the wrong format for std.datetime.Date.from* #10379

Open
dlangBugzillaToGithub opened this issue Jul 9, 2019 · 1 comment
Open
Labels
OS:Linux Issues specific to Linux Severity:Enhancement

Comments

@dlangBugzillaToGithub
Copy link

jurily reported this on 2019-07-09T09:15:29Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=20038

CC List

  • razvan.nitu1305

Description

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 != DayOfWeek.mon);
        return 0;
}
```

Instead there's an error:

```
$ rdmd scratch.d
/data/data/com.termux/files/usr/bin/../include/d/std/datetime/date.d(7766): 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", "-I."]
```
@dlangBugzillaToGithub
Copy link
Author

razvan.nitu1305 commented on 2023-04-18T12:04:49Z

This is not a compiler issue, rather than a phobos one. std.datetime lacks the functionality to transform a compiler provided date into an internal representation.

@LightBender LightBender removed the P4 label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS:Linux Issues specific to Linux Severity:Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants