Releases: github/relative-time-element
v4.1.4
What's Changed
- avoid throwing errors for empty lang attributes by @keithamus in #235
Full Changelog: v4.1.3...v4.1.4
v4.1.3
What's Changed
- fix: fixes examples include to relative-time-element by @rafaeliga in #233
- Increase rounding rules in roundToSingleUnit to 90% of the next largest unit by @keithamus in #234
New Contributors
- @rafaeliga made their first contribution in #233
Full Changelog: v4.1.2...v4.1.3
v4.1.2
Full Changelog: v4.1.1...v4.1.2
v4.1.1
What's Changed
- Add a job to publish the package in GPR by @broccolinisoup in #231
- Actions: Remove
needsfrom the publish-github job by @broccolinisoup in #232
New Contributors
- @broccolinisoup made their first contribution in #231
Full Changelog: v4.1.0...v4.1.1
v4.1.0
What's Changed
- Upgrade all deps by @keithamus in #219
- add formatStyle attribute by @keithamus in #221
- change some Dates to .now() by @keithamus in #222
- add milliseconds to duration type by @keithamus in #223
- Move elapsed to duration by @keithamus in #224
- fix: dasherize formatStyle in observedAttributes by @lyricwulf in #225
- Refactor micro time to use a rounded duration by @keithamus in #226
- Refactor formats by @keithamus in #227
- support format=datetime/format=relative/format=duration by @keithamus in #228
- fix up examples page by @keithamus in #229
- setup npm provenance by @keithamus in #230
New Contributors
- @lyricwulf made their first contribution in #225
Full Changelog: v4.0.0...v4.1.0
v4.0.0
What's Changed
- Version 4 by @keithamus in #218
The following features have been removed:
- The package name has changed from
@github/time-elementsto@github/relative-time-element - The
local-timeelement has been removed. - The
time-agoelement has been removed. - The
time-untilelement has been removed. getFormattedTitleis now only private.getFormattedDateis now only private.formatno longer accepts astrftimecompatible format. Instead, any value other than'micro','elapsed'will revert to the string'auto'- the
Intl.DateTimeFormatconstructor is not ponyfilled, and so in environments without this constructor, the
element will fall back to provided text. - the
Intl.RelativeTimeFormatconstructor will not be ponyfilled, and so in environments without this constructor, the element will fall back to provided text.
Migrating package name change.
You should remove the old @github/time-elements package to avoid conflicts (npm rm @github/time-elements) and install the new version (npm i @github/[email protected]).
Migrating local-time to relative-time.
local-time was a configuration of relative-time. You can replicate the behaviour of local-time with the following relative-time tag:
<relative-time threshold="PT0S" day="numeric" month="short" year="numeric" datetime="$DATE">$DATE</relative-time>Migrating time-ago to relative-time.
time-ago was a configuration of relative-time with a fixed tense. You can replicate the behaviour of time-ago with the following relative-time tag:
<relative-time tense="future" datetime="$DATE">$DATE</relative-time>Migrating time-until to relative-time.
time-until was a configuration of relative-time with a fixed tense. You can replicate the behaviour of time-until with the following relative-time tag:
<relative-time tense="future" datetime="$DATE">$DATE</relative-time>Migrating getFormattedTitle.
getFormattedTitle is now a private function. It is not possible to override this function, nor call it manually.
If you intend to subclass RelativeTimeElement, you can override the update() method which calls getFormattedTitle.
If you wanted to call getFormattedTitle() to retrieve the value, then this can be replaced with getAttribute('title').
Migrating getFormattedDate.
getFormattedDate is now a private function. It is not possible to override this function, nor call it manually.
If you intend to subclass RelativeTimeElement, you can override the update() method which calls getFormattedDate.
If you wanted to call getFormattedDate() to retrieve the value, then this can be replaced with shadowRoot.textContent.
Migrating strftime formatted format.
Using strftime style format strings has been removed. It is not possible to supply custom formatted dates in this way to relative-time.
strftime formatting was not locale aware, in that the position of segments was fixed by the format string - despite it being locale dependant.
Customisation of the date formatting is still possible using the day, month, year, weekday, hour, minute, second proprties. Please refer to the documentation on how to do this.
Migratting Intl.DateTimeFormat & Intl.RelativeTimeFormat ponyfills
This element no longer emulates the Intl.DateTimeFormat and Intl.RelativeTimeFormat classes if they do not exist. On browsers where these do not exist, the element will act as if it were inert, that is the title will not be set and the contents of the element will be whatever was rendered server side.
Intl.DateTimeFormat is supported natively by Chrome (24+), Edge (12+), Safari (10+), Firefox (29+), Opera (15+).
Intl.RelativeTimeFormat is supported natively by Chrome (71+), Edge (79+), Safari (14+), Firefox (65+), Opera (58+).
If you still wish to support older browsers, then please install polyfills for both of these constructors.
Full Changelog: v3.6.0...v4.0.
v4.0.0-pre
What's Changed
- Warn on use of deprecated elements, functions and properties by @keithamus in #217
BREAKING CHANGES
This PR is a BREAKING CHANGE, in which we console.warn on all deprecated features, which we plan to remove in the next version, v4.0.0.
The following features are to be deprecated in v4.0.0:
- The
local-timeelement will be removed. - The
time-agoelement will be removed. - The
time-untilelement will be removed. getFormattedTitlewill be private.getFormattedDatewill be private.formatwill no longer accept astrftimecompatible format. Instead, any value other than'micro','elapsed'will revert to the string'auto'- the
Intl.DateTimeFormatconstructor will not be ponyfilled, and so in environments without this constructor, the
element will fall back to provided text. - the
Intl.RelativeTimeFormatconstructor will not be ponyfilled, and so in environments without this constructor, the element will fall back to provided text.
v4.0.0-pre maintains compatibility with Version 3 but will console.warn on the use of any of these deprecated features. Additionally the typescript definitions have changed which means integrators will need to alter their code for typescript.
v4.0.0-pre will allow integrators to install a version and ship it to production in a backwards-compatible way with v3.x, while refactoring out any uses of deprecated APIs, before finally installing v4.0.0.
Full Changelog: v3.6.0...v4.0.0-pre
v3.6.0
v3.5.2
What's Changed
- avoid updating during update call by @keithamus in #215
- Switch to promise batching on attributechangedcallback by @keithamus in #216
Full Changelog: v3.5.1...v3.5.2
v3.5.1
What's Changed
- fix typo in observed attributes by @keithamus in #212
Full Changelog: v3.5.0...v3.5.1