The better time-element, e.g. live changing relative dates
- live changing relative dates
- generates a title attribute with the absolute date
<u1-time datetime="2013-04-01T18:02" type=relative lang=de>1. April 2013 18:02</u1-time>.
u1-time {
}
<link href="https://cdn.jsdelivr.net/gh/u1ui/time.el@x.x.x/time.min.css" rel=stylesheet>
<script src="https://cdn.jsdelivr.net/gh/u1ui/time.el@x.x.x/time.min.js" type=module></script>
Attribute | Options | Default | Description |
---|---|---|---|
datetime |
ISO 8601 date | required | e.g. 2011-10-10T14:48:00 |
lang |
language | parent lang | If not present navigator.language is used |
type |
date, relative | relative | The way the date should be displayed |
Attribute | Options | Default | Description |
---|---|---|---|
weekday |
narrow, short, long, none | short | Format weekday as Sun or Sunday |
year |
numeric, 2-digit, none | numeric | Format year as 14 or 2014 |
month |
numeric, 2-digit, narrow, short, long, none | numeric | Format month as Jun or June |
day |
numeric, 2-digit, none | numeric | Format day as 01 or 1 |
hour |
numeric, 2-digit, none | none | Format hour as 01 or 1 |
minute |
numeric, 2-digit, none | none | Format minute as 05 or 5 |
second |
numeric, 2-digit, none | none | Format second as 05 or 5 |
Attribute | Options | Default | Description |
---|---|---|---|
mode |
narrow, short, long | short | 28 minutes ago , 29 min. ago |
- recognise the resolution of the given date (has time or not)
- optional provide date as innerHTML
https://github.com/github/relative-time-element
- MIT License, Copyright (c) 2022 (like all repositories in this organization)
- Suggestions, ideas, finding bugs and making pull requests make us very happy. ♥