Releases: JohnRDOrazio/jQuery-Clock-Plugin
Version 2.3.7
What's Changed
- Enhancement: add support for
Intl.DateTimeFormat
0ad6c61 - Enhancement: further modernize the javascript to ECMA 2020: e6a657f, a23b4a5, a744e56, 6f5c8ac
- Enhancement: support PHP format character
T
- Bugfix: calling object parameter without object f754c2d
- Bugfix: fix missing parameter 9c4a7bd
- Remove
padStart
polyfill (now supported in all major browsers) 5ffc2de calendar
option deprecated; usedateFormat: false
instead ofcalendar: false
to remove calendar outputlangSet
option deprecated; uselocale
option instead
Full Changelog: v2.3.6...v2.3.7
Version 2.3.6
performance.timing.navigationStart
has been deprecrated in favor ofperformance.timeOrigin
- optimize code to avoid redundancies, favor readability, using Codefactor as a reference for code quality
- prefer ES6 style arrow function expressions to traditional functions
Full Changelog: v2.3.4...v2.3.6
Independent from system clock + microseconds
- This version becomes relatively independent from the system clock, using Performance.navigation.start + Performance.now() as the fixed reference rather than using System time as the fixed reference. Also corrects for any timezone deviations on the system clock in order to maintain the timezone set on the clock when it was instantiated. So go ahead and play with your system clock and calendar all you want now, it won't affect this jQuery Clock!
- Implements PHP style "u" Format Character for microseconds, which we can now do since we are using Performance.now() which has a 5 microsecond resolution! Not sure if anyone would ever use it or if it can be in any way useful, but hey we do it because we can 😉
Start, Stop, Destroy handlers and methods
- Now returns an instance of the plugin itself along with the dom elements
- Adds "start" and "stop" handlers to the already existing "destroy" handler
- The new "stop" handler does what the old "destroy" handler used to do, while "destroy" now removes completely all html markup produced by the plugin and all associated data
- Adds "destroy()", "start()" and "stop()" methods which have the same effect as the handlers.
Support for literals
Allows for escaped literals and for literal string sequences wrapped in '%' characters inside the dateFormat and timeFormat parameters.
Also exposes all possible option parameters with type, description, and supported values through $.clock.options .
PHP style Format Characters close to full support
Implements all PHP Style Format Characters except for "T" and "u". Adds a "rate" option which allows to customize the rate at which each clock is updated. Bugfix: the month number returned was incorrect in v2.1.6.
Native localization with Intl.DateTimeFormat object
Implements the new Intl.DateTimeFormat object which is now fairly universally supported in ECMA script implementations, completely removing the "locale" paramater from the plugin. It is no longer possible to extend the plugin with customized locales, because the plugin now depends entirely on the native functionality of the Intl.DateTimeFormat object.
PHP Style Format Characters with DST display
Extends support for PHP Style Format Characters including the "I" (capital i) format character which will display whether the Date is in Daylight Saving Time. For example, "Europe/Paris" would normally be UTC+1 but when DST is active it is actually UTC+2. When displaying both "e" (timezone identifier) and "I" (DST state) for a Date in the "Europe/Paris" timezone, a string lik this would be displayed: "UTC+2 DST".
This version also fixes the usage of actual boolean values for those options that use boolean values. Until now it was necessary to pass them in as strings ("true", "false"), now they can be passed in as true booleans (true, false).
In order to have the DST detection functionality, the plugin conditionally extends the Date prototype with two more functions "stdTimezoneOffset" and "isDST" as found in this stackoverflow answer.
PHP Style Format Characters with timezone identifier support
Extends support for PHP Style Format Characters including the "e" format character which will display the timezone identifier. The timezone offset is calculated for client-side timestamps as "UTC", "UTC+1", "UTC-6"; whereas it will have to be passed in for server generated timestamps by using the "timezone" parameter and passing a string value such as "UTC", "UTC+1" (or "EST", "CET" or even "America\Los Angeles" though it may occupy quite a bit of space in the clock).
With this release the "timeFormat" parameter is finally actually "timeFormat", and not "hourFormat"!
Extended locales
This version extends the locales included in the plugin and implements more certain information for shortWeekdays and shortMonths having gathered the information from the ECMA Intl.DateTimeFormat Object.
This bloats the plugin a bit, and may not be useful for all users; this would only be useful for those who need to display a clock in a number of different languages in a dynamic manner.
There are 48 locales included: "am", "ar", "bn", "bg", "ca", "zh", "hr", "cs", "da", "nl", "en", "et", "fi", "fr", "de", "el", "gu", "hi", "hu", "id", "it", "ja", "kn", "ko", "lv", "lt", "ms", "ml", "mr", "mo", "ps", "fa", "pl", "pt", "ro", "ru", "sr", "sk", "sl", "es", "sw", "sv", "ta", "te", "th", "tr", "uk", "vi".
N.B. "timeFormat" parameter is still "hourFormat" in this release!