active
Declarative
Date will be set using the string in the datetime attribute and rendered as an absolute date as it was over a year ago.
<time data-o-component="o-date" class="o-date" datetime="2000-06-14T23:00:00.000Z">June 15, 2000</time> (dates far in the past are formatted as exact dates)
<br>
<time data-o-component="o-date" class="o-date"></time> (more recent dates are formatted as relative times)
<br>
<time data-o-component="o-date" class="o-date" data-o-date-format="today-or-yesterday-or-nothing"></time> (Using the o-date-format option)
<br>
<time data-o-component="o-date" class="o-date" data-o-date-format="time-ago-limit-4-hours"></time> (Using the o-date-format with time-ago-limit-4-hours)
<br>
<time data-o-component="o-date" class="o-date" data-o-date-format="h:mm a"></time> (Using the o-date-format with custom format string)
GitHub Repository
Quickstart
Build Service
Add the following to your
<script>
tag
o-date@^2.11.0
For more information see the Origami build service.
Manual Build Process
Run the following command in the root directory of your project, to add this dependency to your bower.json
file:
bower install --save "o-date"@"^2.11.0"
For more information see the Origami build process.