As discussed at:
Real World Case Study - Build (Online) Books with Markdown and the Jekyll (Static) Website Compiler - Free Ruby Reference 2.5 Book - #4 - Share - Jekyll Talk,
Ruby Date and Time classes do not support the following legal timestamp
format
-
2010-01
require ‘time’
Time.strptime(“2010-01”, “%Y-%m”)
argument out of rangerequire ‘date’
Date.strptime(“2010-01”, “%Y-%m”)
=> #<Date: 2010-01-01 ((2455198j,0s,0n),+0s,2299161j)>
I believe that the two classes date and less importantly time, can not
support a notion of a temporal instance with less absoluteness than a
day or perhaps second. For example a month in a year defaults to the
first minute of the first day of a month.
Is there another class that may be more compatible with the following
definition from Date and Time Formats ?
Different standards may need different levels of granularity in the date
and time, so this profile defines six levels. Standards that reference
this profile should specify one or more of these granularities. If a
given standard allows more than one granularity, it should specify the
meaning of the dates and times with reduced precision, for example, the
result of comparing two dates with different precisions.
The formats are as follows. Exactly the components shown here must be
present, with exactly this punctuation. Note that the “T” appears
literally in the string, to indicate the beginning of the time element,
as specified in ISO 8601.
Year:
YYYY (eg 1997)
Year and month:
YYYY-MM (eg 1997-07)
Complete date:
YYYY-MM-DD (eg 1997-07-16)
Complete date plus hours and minutes:
YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
Complete date plus hours, minutes and seconds:
YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
Complete date plus hours, minutes, seconds and a decimal fraction of
a
second
YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)