Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I semantically define within the <time> tag 'the present'

I am using time tag to define a time—seemed like the right approach ;-)

My problem however is the value I want to place within the time tag is NOW: the present. I get this validation error:

The text content of element time was not in the required format:
The literal did not satisfy the time-datetime format."

Looking at the spec, it doesn't seem possible to define 'NOW'. That's a nuisance. Any ideas on how to approach this?

like image 388
Timidfriendly Avatar asked Apr 06 '13 08:04

Timidfriendly


People also ask

What does the time tag do?

Definition and Usage The <time> tag defines a specific time (or datetime). The datetime attribute of this element is used translate the time into a machine-readable format so that browsers can offer to add date reminders through the user's calendar, and search engines can produce smarter search results.


2 Answers

You cannot. The time element in HTML5 is defined as markup for specific moments or periods or durations of time or for time offsets, not for all concepts related to time.

You can write e.g. <time datetime="2013-04-06T13:53">now</time>, thereby associating a fixed moment of time with the text content “now”. I don’t see how this could be useful, and the usefulness of the time element in general is questionable (it looks like markup for markup’s sake), but things like this are all you can do to “define ‘NOW’” with time.

like image 148
Jukka K. Korpela Avatar answered Oct 08 '22 04:10

Jukka K. Korpela


I'm using this markup for now:

<time datetime="2013">Present</time>

No more errors, and it's symatic. It's just a shame there is no accepted variable for NOW.

like image 30
Timidfriendly Avatar answered Oct 08 '22 04:10

Timidfriendly