Bug 16993 – Documentation for toSimpleString and toString does not explain how they differ

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-12-20T15:32:36Z
Last change time
2018-01-05T13:30:11Z
Keywords
trivial
Assigned to
Jonathan M Davis
Creator
bachmeil

Comments

Comment #0 by bachmeil — 2016-12-20T15:32:36Z
In the documentation for std.datetime.toString, the only thing there is "Converts this DateTime to a string." These two return the same output as far as I can tell: writeln(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toString); writeln(DateTime(Date(2010, 7, 4), TimeOfDay(7, 6, 12)).toSimpleString); There should be an explanation of how they differ so that the reader knows when to use one or the other.
Comment #1 by razvan.nitu1305 — 2017-07-11T08:48:46Z
They don't differ at all. toString just calls toSimpleString and forwards the result.
Comment #2 by issues.dlang — 2017-07-11T10:04:59Z
toString does currently call toSimpleString, but the intention is that if you actually care about the format of the string, you don't use toString. Instead, you use a function like toSimpleString or toISOExtString that's explicit about the format. toString is just intended to convert the type to a user-friendly string, not for specific formatting.
Comment #3 by github-bugzilla — 2017-07-11T12:52:59Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/57ef9199632b8cb5451f9d7d8c76aad29410db84 Fix issue 16993: Clarify documentation of std.datetime's toString functions. I should have done this years ago, but this makes the documentation clear that std.datetime's toString is intended simply for easy printing of the type rather than for code that actually cares about the format of the string. There are other, explicit functions for code that actually cares. https://github.com/dlang/phobos/commit/3324796a2972a2f62ac3f1b73727a5d9e3d5e011 Merge pull request #5592 from jmdavis/issue_16993 Fix issue 16993: Clarify documentation of std.datetime's toString functions. merged-on-behalf-of: Sebastian Wilzbach <[email protected]>
Comment #4 by github-bugzilla — 2017-08-16T13:23:56Z
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/57ef9199632b8cb5451f9d7d8c76aad29410db84 Fix issue 16993: Clarify documentation of std.datetime's toString functions. https://github.com/dlang/phobos/commit/3324796a2972a2f62ac3f1b73727a5d9e3d5e011 Merge pull request #5592 from jmdavis/issue_16993
Comment #5 by github-bugzilla — 2018-01-05T13:30:11Z
Commits pushed to dmd-cxx at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/57ef9199632b8cb5451f9d7d8c76aad29410db84 Fix issue 16993: Clarify documentation of std.datetime's toString functions. https://github.com/dlang/phobos/commit/3324796a2972a2f62ac3f1b73727a5d9e3d5e011 Merge pull request #5592 from jmdavis/issue_16993