Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd example for parsing into chrono::DateTime #351
Conversation
budziq
requested changes
Oct 31, 2017
| [`DateTime::parse_from_str`] respectively. Escape sequences that are available | ||
| for the [`DateTime::parse_from_str`] can be found at | ||
| [`chrono::format::strftime`]. Note that the [`DateTime::parse_from_str`] | ||
| requires that such a DateTime struct must be creatable that it uniquely |
This comment has been minimized.
This comment has been minimized.
budziq
Oct 31, 2017
Collaborator
I would also introduce the Naive{Data, Time, DateTime} family here https://docs.rs/chrono/*/chrono/struct.DateTime.html?search=parse_from_str these are less restrictive in regard to the user input (allow for only date and only time without timezone)
| [RFC 2822], [RFC 3339], and a custom format, using | ||
| [`DateTime::parse_from_rfc2822`], [`DateTime::parse_from_rfc3339`], and | ||
| [`DateTime::parse_from_str`] respectively. Escape sequences that are available | ||
| for the [`DateTime::parse_from_str`] can be found at |
This comment has been minimized.
This comment has been minimized.
budziq
Oct 31, 2017
Collaborator
We might want to split it into two paragraphs (at least the part about escape sequences)
This comment has been minimized.
This comment has been minimized.
|
Extended based on feedback. Is this what we are going after? Do comment if there's still something missing. |
budziq
reviewed
Oct 31, 2017
| found at [`chrono::format::strftime`]. Note that the [`DateTime::parse_from_str`] | ||
| requires that such a DateTime struct must be creatable that it uniquely | ||
| identifies a date and a time. For parsing dates and times without timezones, see | ||
| [`NaiveDate::parse_from_str`], [`NaiveTime::parse_from_str`], and |
This comment has been minimized.
This comment has been minimized.
budziq
Oct 31, 2017
Collaborator
I would suggest to also use these functions in the actual code and just mention here about the types NaiveDate
/ Naivetime / NaiveDateTime
This comment has been minimized.
This comment has been minimized.
budziq
Oct 31, 2017
Collaborator
Is this what we are going after?
Pretty much.
hegza
force-pushed the
hegza:feature/chrono-from-input
branch
2 times, most recently
from
2e4df5e
to
78da090
Oct 31, 2017
This comment has been minimized.
This comment has been minimized.
|
Should be it. I noticed the PR-template as well and checked all things and squashed the commits in accordance with that. |
hegza
force-pushed the
hegza:feature/chrono-from-input
branch
from
78da090
to
64b7117
Oct 31, 2017
This comment has been minimized.
This comment has been minimized.
|
Merged! Thanks @hegza ! |
hegza commentedOct 29, 2017
Add an example for parsing strings in different formats into chrono::DateTime structs.
See also: #324