1.12.3 • Published 2 years ago

@patternfly/pfe-datetime v1.12.3

Weekly downloads
476
License
MIT
Repository
github
Last release
2 years ago

PatternFly Elements Datetime

This element enables developers to get a lot of the features from the Intl Object just by using attributes to set the format of the date and time they'd like to display.

Read more about Datetime in the PatternFly Elements Datetime documentation

Installation

Load <pfe-datetime> via CDN:

<script src="https://unpkg.com/@patternfly/pfe-datetime?module"></script>

Or, if you are using NPM, install it

npm install @patternfly/pfe-datetime

Then once installed, import it to your application:

import '@patternfly/pfe-datetime';

Usage

Just the date: January 2, 2006

<pfe-datetime
  datetime="Mon Jan 2 15:04:05 EST 2006"
  format="local"
  day="numeric"
  month="long"
  year="numeric">
  Mon Jan 2 15:04:05 EST 2006
</pfe-datetime>

With time: Monday, Jan 02, 2006, 3:04:05 PM

<pfe-datetime
  datetime="Mon Jan 2 15:04:05 EST 2006"
  format="local"
  weekday="long"
  month="short"
  day="2-digit"
  year="numeric"
  hour="2-digit"
  minute="2-digit"
  second="2-digit">
  Mon Jan 2 15:04:05 EST 2006
</pfe-datetime>

With an en-GB locale: Monday, 02 Jan 2006, 15:04:05

You can use any locale here.

<pfe-datetime
  datetime="Mon Jan 2 15:04:05 EST 2006"
  format="local"
  weekday="long"
  month="short"
  day="2-digit"
  year="numeric"
  hour="2-digit"
  minute="2-digit"
  second="2-digit"
  locale="en-GB">
  Mon Jan 2 15:04:05 EST 2006
</pfe-datetime>

Time adverbial: 13 years ago

<pfe-datetime
  format="relative"
  datetime="Mon Jan 2 15:04:05 EST 2006">
  Mon Jan 2 15:04:05 EST 2006
</pfe-datetime>
2.0.0-next.4

2 years ago

2.0.0-next.2

2 years ago

2.0.0-next.3

2 years ago

2.0.0-next.1

2 years ago

1.12.3

2 years ago

2.0.0-next.0

2 years ago

1.12.2

2 years ago

1.12.1

2 years ago

1.12.0

2 years ago

1.11.2

3 years ago

1.11.1

3 years ago

1.11.0

3 years ago

1.10.1

3 years ago

1.10.0

3 years ago

1.9.3

3 years ago

1.9.2

3 years ago

1.9.1

3 years ago

1.9.0

3 years ago

1.8.0

3 years ago

1.6.0

3 years ago

1.7.0

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.0

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago

0.0.0-test.1

5 years ago

0.0.0-test.0

5 years ago