Initial commit

This commit is contained in:
talksik
2021-12-29 01:57:42 -08:00
commit ce39a60b42
4634 changed files with 997667 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin["day-of-week"] = factory()));
})(this, (function () { 'use strict';
/**
* @preserve date-and-time.js plugin
* @preserve day-of-week
*/
var plugin = function (date) {
var name = 'day-of-week';
date.plugin(name, {
parser: {
dddd: function (str) { return this.find(this.res.dddd, str); },
ddd: function (str) { return this.find(this.res.ddd, str); },
dd: function (str) { return this.find(this.res.dd, str); }
}
});
return name;
};
return plugin;
}));
+55
View File
@@ -0,0 +1,55 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin.meridiem = factory()));
})(this, (function () { 'use strict';
/**
* @preserve date-and-time.js plugin
* @preserve meridiem
*/
var plugin = function (date) {
var name = 'meridiem';
date.plugin(name, {
res: {
AA: ['A.M.', 'P.M.'],
a: ['am', 'pm'],
aa: ['a.m.', 'p.m.']
},
formatter: {
AA: function (d) {
return this.res.AA[d.getHours() > 11 | 0];
},
a: function (d) {
return this.res.a[d.getHours() > 11 | 0];
},
aa: function (d) {
return this.res.aa[d.getHours() > 11 | 0];
}
},
parser: {
AA: function (str) {
var result = this.find(this.res.AA, str);
result.token = 'A';
return result;
},
a: function (str) {
var result = this.find(this.res.a, str);
result.token = 'A';
return result;
},
aa: function (str) {
var result = this.find(this.res.aa, str);
result.token = 'A';
return result;
}
}
});
return name;
};
return plugin;
}));
+39
View File
@@ -0,0 +1,39 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin.microsecond = factory()));
})(this, (function () { 'use strict';
/**
* @preserve date-and-time.js plugin
* @preserve microsecond
*/
var plugin = function (date) {
var name = 'microsecond';
date.plugin(name, {
parser: {
SSSSSS: function (str) {
var result = this.exec(/^\d{1,6}/, str);
result.value = result.value / 1000 | 0;
return result;
},
SSSSS: function (str) {
var result = this.exec(/^\d{1,5}/, str);
result.value = result.value / 100 | 0;
return result;
},
SSSS: function (str) {
var result = this.exec(/^\d{1,4}/, str);
result.value = result.value / 10 | 0;
return result;
}
}
});
return name;
};
return plugin;
}));
+42
View File
@@ -0,0 +1,42 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin.ordinal = factory()));
})(this, (function () { 'use strict';
/**
* @preserve date-and-time.js plugin
* @preserve ordinal
*/
var plugin = function (date) {
var name = 'ordinal';
date.plugin(name, {
formatter: {
DDD: function (d) {
var day = d.getDate();
switch (day) {
case 1:
case 21:
case 31:
return day + 'st';
case 2:
case 22:
return day + 'nd';
case 3:
case 23:
return day + 'rd';
default:
return day + 'th';
}
}
}
});
return name;
};
return plugin;
}));
+83
View File
@@ -0,0 +1,83 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin.timespan = factory()));
})(this, (function () { 'use strict';
/**
* @preserve date-and-time.js plugin
* @preserve timespan
*/
var plugin = function (date) {
var timeSpan = function (date1, date2) {
var milliseconds = function (dt, time) {
dt.S = time;
return dt;
},
seconds = function (dt, time) {
dt.s = time / 1000 | 0;
return milliseconds(dt, Math.abs(time) % 1000);
},
minutes = function (dt, time) {
dt.m = time / 60000 | 0;
return seconds(dt, Math.abs(time) % 60000);
},
hours = function (dt, time) {
dt.H = time / 3600000 | 0;
return minutes(dt, Math.abs(time) % 3600000);
},
days = function (dt, time) {
dt.D = time / 86400000 | 0;
return hours(dt, Math.abs(time) % 86400000);
},
format = function (dt, formatString) {
var pattern = date.compile(formatString);
var str = '';
for (var i = 1, len = pattern.length, token, value; i < len; i++) {
token = pattern[i].charAt(0);
if (token in dt) {
value = '' + Math.abs(dt[token]);
while (value.length < pattern[i].length) {
value = '0' + value;
}
if (dt[token] < 0) {
value = '-' + value;
}
str += value;
} else {
str += pattern[i].replace(/\[(.*)]/, '$1');
}
}
return str;
},
delta = date1.getTime() - date2.getTime();
return {
toMilliseconds: function (formatString) {
return format(milliseconds({}, delta), formatString);
},
toSeconds: function (formatString) {
return format(seconds({}, delta), formatString);
},
toMinutes: function (formatString) {
return format(minutes({}, delta), formatString);
},
toHours: function (formatString) {
return format(hours({}, delta), formatString);
},
toDays: function (formatString) {
return format(days({}, delta), formatString);
}
};
};
var name = 'timespan';
date.plugin(name, { extender: { timeSpan: timeSpan } });
return name;
};
return plugin;
}));
+81
View File
@@ -0,0 +1,81 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin.timezone = factory()));
})(this, (function () { 'use strict';
/**
* @preserve date-and-time.js plugin
* @preserve timezone
*/
var plugin = function (date, localized_date) {
var options = {
year: 'numeric', month: 'numeric', day: 'numeric',
hour: 'numeric', minute: 'numeric', second: 'numeric'
};
var pattern = date.compile('M/D/Y, h:mm:ss A');
var formatTZ = function (dateObj, arg, timeZone) {
options.timeZone = 'UTC';
var utcObj = date.parse(new Intl.DateTimeFormat('en-US', options).format(dateObj), pattern);
options.timeZone = timeZone;
var dateObj2 = date.parse(new Intl.DateTimeFormat('en-US', options).format(dateObj), pattern);
var dateObj3 = date.addMilliseconds(dateObj2, dateObj.getMilliseconds());
dateObj3.getTimezoneOffset = function () { return (utcObj.getTime() - dateObj2.getTime()) / 60000 | 0; };
return localized_date.format(dateObj3, arg);
};
var adjustments = [
-60, -30, -20,
0,
60, 30, 20
];
var parseTZ = function (dateString, arg, timeZone) {
var pattern2 = typeof arg === 'string' ? date.compile(arg) : arg;
var dateObj = localized_date.parse(dateString, pattern2, true);
for (var i = 1, len = pattern2.length; i < len; i++) {
if (pattern2[i].indexOf('Z') === 0) {
return dateObj;
}
}
options.timeZone = timeZone;
var dateTimeFormat = new Intl.DateTimeFormat('en-US', options);
var dateObj2 = date.addMilliseconds(
date.parse(dateTimeFormat.format(dateObj), pattern, true),
dateObj.getMilliseconds()
);
var offset = dateObj.getTime() - dateObj2.getTime();
var dateString2 = date.format(localized_date.parse(dateString, pattern2), pattern);
var comparer = function (d) {
return dateString2 === dateTimeFormat.format(d);
};
// Trying to adjust for daylight saving time.
for (var j = 0, len2 = adjustments.length; j < len2; j++) {
var d = date.addMilliseconds(dateObj, offset + adjustments[j] * 60000);
if (comparer(d)) {
return d;
}
}
return NaN;
};
var name = 'timezone';
date.plugin(name, {
extender: {
formatTZ: formatTZ,
parseTZ: parseTZ
}
});
return name;
};
return plugin;
}));
+29
View File
@@ -0,0 +1,29 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin["two-digit-year"] = factory()));
})(this, (function () { 'use strict';
/**
* @preserve date-and-time.js plugin
* @preserve two-digit-year
*/
var plugin = function (date) {
var name = 'two-digit-year';
date.plugin(name, {
parser: {
YY: function (str) {
var result = this.exec(/^\d\d/, str);
result.value += result.value < 70 ? 2000 : 1900;
return result;
}
}
});
return name;
};
return plugin;
}));