Bug 17922 – SysTime.to

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2017-10-21T10:00:30Z
Last change time
2017-10-21T22:33:44Z
Assigned to
No Owner
Creator
Uranuz

Comments

Comment #0 by neuranuz — 2017-10-21T10:00:30Z
The following example prints unexpected `:00` at the end of formated date string. import std.datetime; import std.stdio; void main() { SysTime dt = SysTime.fromISOExtString(`2017-10-21T12:59:34.196246+04`); writeln(dt); writeln(dt.toISOExtString()); writeln(dt.toISOString()); } Application output: 2017-Oct-21 12:59:34.196246+04:00 2017-10-21T12:59:34.196246+04:00 20171021T125934.196246+04:00
Comment #1 by issues.dlang — 2017-10-21T10:07:18Z
So, what's the bug? toISOString does incorrectly put a colon in the timezone, which is bug https://issues.dlang.org/show_bug.cgi?id=15654 But the others are supposed to put a colon there. Were you expecting that there wouldn't be a :00 on the end because you passed a string without it to fromISOExtString? It's not like the SysTime keeps track of how it was created. Or did you expect that the :00 would be stripped off just because it's zeroes? Or is it something else? to*String never strips out zeroes from the time zone if that's what you're looking for.
Comment #2 by neuranuz — 2017-10-21T11:06:54Z
It seems that it was just misunderstanding that it's a minute part in timezone offset. I should post this question at dlang forum first before issuing an error. So there is no problem here.
Comment #3 by issues.dlang — 2017-10-21T22:33:44Z
Yeah, unfortunately, there are a number of time zones that don't line up on the hour (usually they then line up on the half hour, but IIRC, not even that is always the case).