MCPcopy Create free account
hub / github.com/Semporia/Scripts / format

Function format

jd_factory_component.js:397–429  ·  view source on GitHub ↗
(a, time)

Source from the content-addressed store, hash-verified

395}
396
397function format(a, time) {
398 if (!a) a = 'yyyy-MM-dd';
399 var t;
400 if (!time) {
401 t = Date.now();
402 } else {
403 t = new Date(time);
404 }
405 var e,
406 n = new Date(t),
407 d = a,
408 l = {
409 'M+': n.getMonth() + 1,
410 'd+': n.getDate(),
411 'D+': n.getDate(),
412 'h+': n.getHours(),
413 'H+': n.getHours(),
414 'm+': n.getMinutes(),
415 's+': n.getSeconds(),
416 'w+': n.getDay(),
417 'q+': Math.floor((n.getMonth() + 3) / 3),
418 'S+': n.getMilliseconds(),
419 };
420 /(y+)/i.test(d) && (d = d.replace(RegExp.$1, ''.concat(n.getFullYear()).substr(4 - RegExp.$1.length)));
421 Object.keys(l).forEach(e => {
422 if (new RegExp('('.concat(e, ')')).test(d)) {
423 var t,
424 a = 'S+' === e ? '000' : '00';
425 d = d.replace(RegExp.$1, 1 == RegExp.$1.length ? l[e] : ''.concat(a).concat(l[e]).substr(''.concat(l[e]).length));
426 }
427 });
428 return d;
429}
430
431function decrypt(time, stk, type, url) {
432 stk = stk || (url ? getUrlQueryParams(url, '_stk') : '')

Callers 1

decryptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected