[whatwg] Historic dates in HTML5

On Thu, Mar 5, 2009 at 6:16 AM, Philip Taylor <excors+whatwg at gmail.com> wrote:
> But given HTML5's restrictions against BCE years, they'd actually have
> to write something more like:
>
> ?if ($t->getYear() > 0) { # (be careful not to write ">= 0" here)
> ? ?print "<time class=time
> datetime=".$t->toISO8601Date().">".$t->toLocalisedHumanReadableDate()."</time>";
> ?} else {
> ? ?print "<span class=time>".$t->toLocalisedHumanReadableDate()."</span>";
> ?}
>
> and make sure their stylesheets use the selector ".time" instead of
> "time", to guarantee everything is going to work correctly even with
> unexpected input values.
>
> So the restriction adds complexity (and bugs) to code that wants to be
> good and careful and generate valid markup.

They may have to do so if they reasonably expect their dates to cross
the 0 demarcation.  The intended uses of <time> will *not* be expected
to do so.  For example, someone writing a calendar app can safely
assume that any and all dates they have to deal with are within the
appropriate era.

~TJ

Received on Thursday, 5 March 2009 04:55:31 UTC