8000 GitHub - dominicbarnes/deku-time: A component for rendering a datetime for people and machines using an HTML5 <time> element. · GitHub
[go: up one dir, main page]

Skip to content
dominicbarnesPublic

About

A component for rendering a datetime for people and machines using an HTML5 <time> element.

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

deku-time

A component for rendering a datetime using an HTML5 <time> element. It supports just about any display format supported by moment as well as auto-updating on a set interval.

npm version npm dependencies npm dev dependencies build status

Example

<Time datetime="now" format="LLLL" />
<Time datetime={createdAt} from="now" refresh="1s" />
<Time datetime={createdAt} calendar="now" />

Attributes

datetime

This determines the date/time to display. Anything accepted by moment is supported, and the value "now" is treated as a special case. (by excluding the attribute altogether, "now" is assumed)

format

If passed, this will render the datetime using format().

from

If passed, this will render the datetime using from(date). (anything accepted by moment is supported) The value "now" is treated as a special case. (and will use fromNow() instead)

to

If passed, this will render the datetime using to(date). (anything accepted by moment is supported) The value "now" is treated as a special case. (and will use toNow() instead)

calendar

If passed, this will render the datetime using calendar(date). (anything accepted by moment is supported) The value "now" is treated as a special case.

refresh

If passed, the component will auto-update on the given interval. Generally, this is useful when displaying relative times so that the displayed value doesn't become stale.

class

Used to extend the <time> element with your own CSS hooks. (passed to magic-virtual-element)

About

A component for rendering a datetime for people and machines using an HTML5 <time> element.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0