JSFiddle - React, Tailwind, and code Playground
by nobuts
HTML
<span id="limit"></span>
JavaScript
! function(a) {
"use strict";
"function" == typeof define && define.amd ? define(["jquery"], a) : a(jQuery)
}(function(a) {
"use strict";
function b(a) {
if (a instanceof Date) return a;
if (String(a).match(g)) return String(a).match(/^[0-9]*$/) && (a = Number(a)), String(a).match(/\-/) && (a = String(a).replace(/\-/g, "/")), new Date(a);
throw new Error("Couldn't cast `" + a + "` to a date object.")
}
function c(a) {
return function(b) {
var c = b.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);
if (c)
for (var e = 0, f = c.length; f > e; ++e) {
var g = c[e].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/),
i = new RegExp(g[0]),
j = g[1] || "",
k = g[3] || "",
l = null;
g = g[2], h.hasOwnProperty(g) && (l = h[g], l = Number(a[l])), null !== l && ("!" === j && (l = d(k, l)), "" === j && 10 > l && (l = "0" + l.toString()), b = b.replace(i, l.toString()))
}
return b = b.replace(/%%/, "%")
}
}
function d(a, b) {
var c = "s",
d = "";
return a && (a = a.replace(/(:|;|\s)/gi, "").split(/\,/), 1 === a.length ? c = a[0] : (d = a[0], c = a[1])), 1 === Math.abs(b) ? d : c
}
var e = 100,
f = [],
g = [];
g.push(/^[0-9]*$/.source), g.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source), g.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source), g = new RegExp(g.join("|"));
var h = {
Y: "years",
m: "months",
w: "weeks",
d: "days",
D: "totalDays",
H: "hours",
M: "minutes",
S: "seconds"
},
i = function(b, c, d) {
this.el = b, this.$el = a(b), this.interval = null, this.offset = {}, this.instanceNumber = f.length, f.push(this), this.$el.data("countdown-instance", this.instanceNumber), d && (this.$el.on("update.countdown", d), this.$el.on("stoped.countdown", d), this.$el.on("finish.countdown", d)), this.setFinalDate(c), this.start()
...