0.1.5 • Published 1 year ago

local-time-element v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

local-time-element

An element that enhances the <time> element in order to display a localised time.

Installation

$ pnpm add local-time-element

# OR

$ npm add local-time-element

Usage

This package uses Intl.DateTimeFormat to format the date in the locale of the user. It accepts the following options from it as properties:

  • locales
  • weekday
  • era
  • year
  • month
  • day
  • dayPeriod
  • hour
  • minute
  • second
  • timeZoneName
  • dateStyle
  • timeStyle

By default every value is undefined.

These properties can also be set as attributes in lowercase. E.g. timeZoneName would be timezonename.

<script type="module">
    import 'local-time-element/dist/local-time-element.js';
</script>
<local-time datestyle="full" timestyle="full">
    <time datetime="2021-01-01T00:00Z">Jan 1, 2021</time>
</local-time>

The value within <time> will be overwritten. In my time zone this would display: Friday, January 1, 2021 at 1:00:00 AM Central European Standard Time

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago