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

Fix Time::Format API doc #6578

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/time/format/custom/http_date.cr
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
require "./rfc_2822"

# Parse a time string using the formats specified by [RFC 2616](https://tools.ietf.org/html/rfc2616#section-3.3.1).
#
# Supported formats:
# * [RFC 1123](https://tools.ietf.org/html/rfc1123#page-55)
# * [RFC 850](https://tools.ietf.org/html/rfc850#section-2.1.4)
# * [asctime](http://en.cppreference.com/w/c/chrono/asctime)
#
# ```
# Time::Format::HTTP_DATE.parse("Sun, 14 Feb 2016 21:00:00 GMT") # => 2016-02-14 21:00:00 UTC
# Time::Format::HTTP_DATE.parse("Sunday, 14-Feb-16 21:00:00 GMT") # => 2016-02-14 21:00:00 UTC
# Time::Format::HTTP_DATE.parse("Sun Feb 14 21:00:00 2016") # => 2016-02-14 21:00:00 UTC
#
# Time::Format::HTTP_DATE.format(Time.utc(2016, 2, 15)) # => "Mon, 15 Feb 2016 00:00:00 GMT"
# ```
struct Time::Format
# Parse a time string using the formats specified by [RFC 2616](https://tools.ietf.org/html/rfc2616#section-3.3.1).
#
# Supported formats:
# * [RFC 1123](https://tools.ietf.org/html/rfc1123#page-55)
# * [RFC 850](https://tools.ietf.org/html/rfc850#section-2.1.4)
# * [asctime](http://en.cppreference.com/w/c/chrono/asctime)
#
# ```
# Time::Format::HTTP_DATE.parse("Sun, 14 Feb 2016 21:00:00 GMT") # => 2016-02-14 21:00:00 UTC
# Time::Format::HTTP_DATE.parse("Sunday, 14-Feb-16 21:00:00 GMT") # => 2016-02-14 21:00:00 UTC
# Time::Format::HTTP_DATE.parse("Sun Feb 14 21:00:00 2016") # => 2016-02-14 21:00:00 UTC
#
# Time::Format::HTTP_DATE.format(Time.utc(2016, 2, 15)) # => "Mon, 15 Feb 2016 00:00:00 GMT"
# ```
module HTTP_DATE
# Parses a string into a `Time`.
def self.parse(string, location = Time::Location::UTC) : Time
Expand Down
6 changes: 3 additions & 3 deletions src/time/format/custom/rfc_2822.cr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# The [RFC 2822](https://tools.ietf.org/html/rfc2822) datetime format.
#
# This is also compatible to [RFC 882](https://tools.ietf.org/html/rfc882) and [RFC 1123](https://tools.ietf.org/html/rfc1123#page-55).
struct Time::Format
# The [RFC 2822](https://tools.ietf.org/html/rfc2822) datetime format.
#
# This is also compatible to [RFC 882](https://tools.ietf.org/html/rfc882) and [RFC 1123](https://tools.ietf.org/html/rfc1123#page-55).
module RFC_2822
# Parses a string into a `Time`.
def self.parse(string, kind = Time::Location::UTC) : Time
Expand Down
2 changes: 1 addition & 1 deletion src/time/format/custom/rfc_3339.cr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# The [RFC 3339](https://tools.ietf.org/html/rfc3339) datetime format ([ISO 8601](http://xml.coverpages.org/ISO-FDIS-8601.pdf) profile).
struct Time::Format
# The [RFC 3339](https://tools.ietf.org/html/rfc3339) datetime format ([ISO 8601](http://xml.coverpages.org/ISO-FDIS-8601.pdf) profile).
module RFC_3339
# Parses a string into a `Time`.
def self.parse(string, location = Time::Location::UTC) : Time
Expand Down