New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

mudate

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mudate - npm Package Compare versions

Comparing version
1.1.0
to
1.1.1
+2
_dist/bundle.js
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"ms",function(){return r}),n.d(t,"ss",function(){return o}),n.d(t,"mm",function(){return u}),n.d(t,"HH",function(){return i}),n.d(t,"µDate",function(){return c});const r=1,o=1e3,u=60*o,i=60*u;class c extends Date{constructor(...e){if(1==e.length)super(...e);else if(e.length>1&&"string"==typeof e.slice(-1)[0]){const t=-1*c.timeZoneOffset(e.pop())*u;super(+new Date(...e)+t)}else super(...e.splice(7))}timeShift(e){return this.setTime(this.getTime()+e),this}}c.timeZoneOffset=e=>{const t=new Date;if(!e)return t.getTimezoneOffset();const n=t.toLocaleString("en-US",{timeZone:e});return Math.round((+new Date(n)-+t)/u)},e.µDate=c}.call(this,n(1))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n}]);
//# sourceMappingURL=bundle.js.map
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./_sources/index.ts","webpack:///(webpack)/buildin/global.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","__webpack_exports__","global","ms","ss","mm","HH","µDate","Date","[object Object]","args","length","super","slice","timeZoneOffset","pop","splice","milliseconds","this","setTime","getTime","timeZoneStr","localeDate","getTimezoneOffset","tzDateString","toLocaleString","timeZone","Math","round","g","Function","e","window"],"mappings":"aACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA,IAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,EAAA,CAA0CK,YAAA,EAAAC,IAAAL,KAK1CZ,EAAAkB,EAAA,SAAAhB,GACA,oBAAAiB,eAAAC,aACAN,OAAAC,eAAAb,EAAAiB,OAAAC,YAAA,CAAwDC,MAAA,WAExDP,OAAAC,eAAAb,EAAA,cAAiDmB,OAAA,KAQjDrB,EAAAsB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAArB,EAAAqB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFA1B,EAAAkB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UACzC,EAAAE,GAAA,iBAAAF,EAAA,QAAAM,KAAAN,EAAArB,EAAAU,EAAAe,EAAAE,EAAA,SAAAA,GAAgH,OAAAN,EAAAM,IAAqBC,KAAA,KAAAD,IACrI,OAAAF,GAIAzB,EAAA6B,EAAA,SAAA1B,GACA,IAAAS,EAAAT,KAAAqB,WACA,WAA2B,OAAArB,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAH,EAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAiB,EAAAC,GAAsD,OAAAjB,OAAAkB,UAAAC,eAAA1B,KAAAuB,EAAAC,IAGtD/B,EAAAkC,EAAA,GAIAlC,IAAAmC,EAAA,kCCjFAnC,EAAAkB,EAAAkB,GAAA,SAAAC,GAAArC,EAAAU,EAAA0B,EAAA,uBAAAE,IAAAtC,EAAAU,EAAA0B,EAAA,uBAAAG,IAAAvC,EAAAU,EAAA0B,EAAA,uBAAAI,IAAAxC,EAAAU,EAAA0B,EAAA,uBAAAK,IAAAzC,EAAAU,EAAA0B,EAAA,0BAAAM,IAAO,MAAMJ,EAAS,EAETC,EAAS,IAETC,EAAc,GAALD,EAETE,EAAc,GAALD,EAKf,MAAME,UAAcC,KAEzBC,eAAeC,GACb,GAAmB,GAAfA,EAAKC,OAAcC,SAAUF,QAC5B,GAAIA,EAAKC,OAAS,GAAkC,iBAAtBD,EAAKG,OAAO,GAAG,GAAkB,CAClE,MAAMC,GAAkB,EAAIP,EAAMO,eAAgBJ,EAAKK,OAAUV,EACjEO,OAAS,IAAIJ,QAAQE,GAAqBI,QAE1CF,SAAUF,EAAKM,OAAO,IAY1BP,UAAUQ,GAER,OADAC,KAAKC,QAASD,KAAKE,UAAYH,GACxBC,MAVFX,EAAAO,eAAmBO,IACxB,MAAMC,EAAa,IAAId,KACvB,IAAKa,EAAc,OAAOC,EAAWC,oBAErC,MAAMC,EAAe,EAAaC,eAAe,QAAS,CAACC,SAAUL,IACrE,OAAOM,KAAKC,QAAW,IAAIpB,KAAKgB,IAAmBF,GAAgBjB,IAUtEH,EAAeK,MAAQA,kCCvCxB,IAAAsB,EAGAA,EAAA,WACA,OAAAX,KADA,GAIA,IAEAW,KAAA,IAAAC,SAAA,iBACC,MAAAC,GAED,iBAAAC,SAAAH,EAAAG,QAOAhE,EAAAD,QAAA8D","file":"bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","type MS = number\nexport const ms: MS = 1;\ntype SS = number\nexport const ss: SS = 1000;\ntype MM = number\nexport const mm: MM = ss * 60;\ntype HH = number\nexport const HH: HH = mm * 60;\n\ntype DateArgs= [any?, any?, any?, any?, any?, any?, any?]\ntype µDateArgs= [any?, any?, any?, any?, any?, any?, any?, string?]\n\nexport class µDate extends Date {\n\n constructor(...args: µDateArgs){\n if( args.length == 1 ) super( ...args as DateArgs )\n else if( args.length > 1 && typeof args.slice(-1)[0] === 'string' ) {\n const timeZoneOffset = -1 * µDate.timeZoneOffset( args.pop() ) * mm\n super( (+new Date(...args as DateArgs)) + timeZoneOffset )\n }else{\n super( ...args.splice(7) as DateArgs )\n }\n }\n\n static timeZoneOffset = ( timeZoneStr?: string ) => {\n const localeDate = new Date()\n if( !timeZoneStr ) return localeDate.getTimezoneOffset()\n\n const tzDateString = (localeDate).toLocaleString('en-US', {timeZone: timeZoneStr} )\n return Math.round( ( (+new Date(tzDateString)) - (+localeDate) ) / mm )\n }\n\n timeShift(milliseconds: MS){\n this.setTime( this.getTime() + milliseconds )\n return this\n }\n\n}\n\n(global as any).µDate = µDate;\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n"],"sourceRoot":""}
declare type MS = number;
export declare const ms: MS;
declare type SS = number;
export declare const ss: SS;
declare type MM = number;
export declare const mm: MM;
declare type HH = number;
export declare const HH: HH;
declare type µDateArgs = [any?, any?, any?, any?, any?, any?, any?, string?];
export declare class µDate extends Date {
constructor(...args: µDateArgs);
static timeZoneOffset: (timeZoneStr?: string | undefined) => number;
timeShift(milliseconds: MS): this;
}
export {};
//# sourceMappingURL=µDate.d.ts.map
{"version":3,"file":"µDate.d.ts","sourceRoot":"","sources":["../_sources/µDate.ts"],"names":[],"mappings":"AAAA,aAAK,EAAE,GAAG,MAAM,CAAA;AAChB,eAAO,MAAM,EAAE,EAAE,EAAM,CAAC;AACxB,aAAK,EAAE,GAAG,MAAM,CAAA;AAChB,eAAO,MAAM,EAAE,EAAE,EAAS,CAAC;AAC3B,aAAK,EAAE,GAAG,MAAM,CAAA;AAChB,eAAO,MAAM,EAAE,EAAE,EAAY,CAAC;AAC9B,aAAK,EAAE,GAAG,MAAM,CAAA;AAChB,eAAO,MAAM,EAAE,EAAE,EAAY,CAAC;AAG9B,aAAK,SAAS,GAAE,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;AAEnE,qBAAa,KAAM,SAAQ,IAAI;gBAEjB,GAAG,IAAI,EAAE,SAAS;IAU9B,MAAM,CAAC,cAAc,+CAMpB;IAED,SAAS,CAAC,YAAY,EAAE,EAAE;CAK3B"}
export const ms = 1;
export const ss = 1000;
export const mm = ss * 60;
export const HH = mm * 60;
export class µDate extends Date {
constructor(...args) {
if (args.length == 1)
super(...args);
else if (args.length > 1 && typeof args.slice(-1)[0] === 'string') {
const timeZoneOffset = -1 * µDate.timeZoneOffset(args.pop()) * mm;
super((+new Date(...args)) + timeZoneOffset);
}
else {
super(...args.splice(7));
}
}
timeShift(milliseconds) {
this.setTime(this.getTime() + milliseconds);
return this;
}
}
µDate.timeZoneOffset = (timeZoneStr) => {
const localeDate = new Date();
if (!timeZoneStr)
return localeDate.getTimezoneOffset();
const tzDateString = (localeDate).toLocaleString('en-US', { timeZone: timeZoneStr });
return Math.round(((+new Date(tzDateString)) - (+localeDate)) / mm);
};
global.µDate = µDate;
//# sourceMappingURL=µDate.js.map
{"version":3,"file":"µDate.js","sourceRoot":"","sources":["../_sources/µDate.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,EAAE,GAAO,CAAC,CAAC;AAExB,MAAM,CAAC,MAAM,EAAE,GAAO,IAAI,CAAC;AAE3B,MAAM,CAAC,MAAM,EAAE,GAAO,EAAE,GAAG,EAAE,CAAC;AAE9B,MAAM,CAAC,MAAM,EAAE,GAAO,EAAE,GAAG,EAAE,CAAC;AAK9B,MAAM,OAAO,KAAM,SAAQ,IAAI;IAE7B,YAAY,GAAG,IAAe;QAC5B,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC;YAAG,KAAK,CAAE,GAAG,IAAgB,CAAE,CAAA;aAC9C,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAG;YAClE,MAAM,cAAc,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,cAAc,CAAE,IAAI,CAAC,GAAG,EAAE,CAAE,GAAG,EAAE,CAAA;YACnE,KAAK,CAAE,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,IAAgB,CAAC,CAAC,GAAG,cAAc,CAAE,CAAA;SAC3D;aAAI;YACH,KAAK,CAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAa,CAAE,CAAA;SACvC;IACH,CAAC;IAUD,SAAS,CAAC,YAAgB;QACxB,IAAI,CAAC,OAAO,CAAE,IAAI,CAAC,OAAO,EAAE,GAAG,YAAY,CAAE,CAAA;QAC7C,OAAO,IAAI,CAAA;IACb,CAAC;;AAXM,oBAAc,GAAG,CAAE,WAAoB,EAAG,EAAE;IACjD,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAA;IAC7B,IAAI,CAAC,WAAW;QAAG,OAAO,UAAU,CAAC,iBAAiB,EAAE,CAAA;IAExD,MAAM,YAAY,GAAG,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC,OAAO,EAAE,EAAC,QAAQ,EAAE,WAAW,EAAC,CAAE,CAAA;IACnF,OAAO,IAAI,CAAC,KAAK,CAAE,CAAE,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAE,GAAG,EAAE,CAAE,CAAA;AACzE,CAAC,CAAA;AASF,MAAc,CAAC,KAAK,GAAG,KAAK,CAAC"}
type MS = number
export const ms: MS = 1;
type SS = number
export const ss: SS = 1000;
type MM = number
export const mm: MM = ss * 60;
type HH = number
export const HH: HH = mm * 60;
type DateArgs= [any?, any?, any?, any?, any?, any?, any?]
type µDateArgs= [any?, any?, any?, any?, any?, any?, any?, string?]
export class µDate extends Date {
constructor(...args: µDateArgs){
if( args.length == 1 ) super( ...args as DateArgs )
else if( args.length > 1 && typeof args.slice(-1)[0] === 'string' ) {
const timeZoneOffset = -1 * µDate.timeZoneOffset( args.pop() ) * mm
super( (+new Date(...args as DateArgs)) + timeZoneOffset )
}else{
super( ...args.splice(7) as DateArgs )
}
}
static timeZoneOffset = ( timeZoneStr?: string ) => {
const localeDate = new Date()
if( !timeZoneStr ) return localeDate.getTimezoneOffset()
const tzDateString = (localeDate).toLocaleString('en-US', {timeZone: timeZoneStr} )
return Math.round( ( (+new Date(tzDateString)) - (+localeDate) ) / mm )
}
timeShift(milliseconds: MS){
this.setTime( this.getTime() + milliseconds )
return this
}
}
(global as any).µDate = µDate;
+1
-1

@@ -19,3 +19,3 @@ <!DOCTYPE html>

</style>
<script src="index.js"></script>
<script src="bundle.js"></script>
</head>

@@ -22,0 +22,0 @@

{
"name": "mudate",
"version": "1.1.0",
"version": "1.1.1",
"description": "µDate is a superset of Date that helps you handle timezones",

@@ -9,3 +9,3 @@ "main": "_dist/index.js",

"start": "webpack-dev-server --mode development --progress --color --open",
"build": "tsc",
"build": "webpack && tsc",
"publish:gh-pages": "git checkout master; npm run build; git subtree split --prefix _dist -b gh-pages; git push -f origin gh-pages:gh-pages; git branch -D gh-pages",

@@ -12,0 +12,0 @@ "publish:npmjs": "npm publish"

@@ -5,3 +5,3 @@ {

"outDir": "./_dist/",
"noImplicitAny": true,
"strict": true,
"target": "es6",

@@ -11,4 +11,6 @@ "module": "es6",

"declarationMap": true,
"sourceMap": true
"sourceMap": true,
"listEmittedFiles": true,
"pretty": true
}
}

@@ -5,4 +5,4 @@ const path = require('path');

module.exports = {
entry: './_sources/index.ts',
devtool: 'inline-source-map',
entry: './_sources/µDate.ts',
devtool: 'source-map',
devServer: {

@@ -24,3 +24,3 @@ contentBase: './_dist'

output: {
filename: 'index.js',
filename: 'bundle.js',
path: path.resolve(__dirname, '_dist')

@@ -27,0 +27,0 @@ },

declare type MS = number;
export declare const ms: MS;
declare type SS = number;
export declare const ss: SS;
declare type MM = number;
export declare const mm: MM;
declare type HH = number;
export declare const HH: HH;
declare type µDateArgs = [any?, any?, any?, any?, any?, any?, any?, string?];
export declare class µDate extends Date {
constructor(...args: µDateArgs);
static timeZoneOffset: (timeZoneStr?: string) => number;
timeShift(milliseconds: MS): this;
}
export {};
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../_sources/index.ts"],"names":[],"mappings":"AAAA,aAAK,EAAE,GAAG,MAAM,CAAA;AAChB,eAAO,MAAM,EAAE,EAAE,EAAM,CAAC;AACxB,aAAK,EAAE,GAAG,MAAM,CAAA;AAChB,eAAO,MAAM,EAAE,EAAE,EAAS,CAAC;AAC3B,aAAK,EAAE,GAAG,MAAM,CAAA;AAChB,eAAO,MAAM,EAAE,EAAE,EAAY,CAAC;AAC9B,aAAK,EAAE,GAAG,MAAM,CAAA;AAChB,eAAO,MAAM,EAAE,EAAE,EAAY,CAAC;AAG9B,aAAK,SAAS,GAAE,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;AAEnE,qBAAa,KAAM,SAAQ,IAAI;gBAEjB,GAAG,IAAI,EAAE,SAAS;IAU9B,MAAM,CAAC,cAAc,mCAMpB;IAED,SAAS,CAAC,YAAY,EAAE,EAAE;CAK3B"}
export const ms = 1;
export const ss = 1000;
export const mm = ss * 60;
export const HH = mm * 60;
export class µDate extends Date {
constructor(...args) {
if (args.length == 1)
super(...args);
else if (args.length > 1 && typeof args.slice(-1)[0] === 'string') {
const timeZoneOffset = -1 * µDate.timeZoneOffset(args.pop()) * mm;
super((+new Date(...args)) + timeZoneOffset);
}
else {
super(...args.splice(7));
}
}
timeShift(milliseconds) {
this.setTime(this.getTime() + milliseconds);
return this;
}
}
µDate.timeZoneOffset = (timeZoneStr) => {
const localeDate = new Date();
if (!timeZoneStr)
return localeDate.getTimezoneOffset();
const tzDateString = (localeDate).toLocaleString('en-US', { timeZone: timeZoneStr });
return Math.round(((+new Date(tzDateString)) - (+localeDate)) / mm);
};
global.µDate = µDate;
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sourceRoot":"","sources":["../_sources/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,EAAE,GAAO,CAAC,CAAC;AAExB,MAAM,CAAC,MAAM,EAAE,GAAO,IAAI,CAAC;AAE3B,MAAM,CAAC,MAAM,EAAE,GAAO,EAAE,GAAG,EAAE,CAAC;AAE9B,MAAM,CAAC,MAAM,EAAE,GAAO,EAAE,GAAG,EAAE,CAAC;AAK9B,MAAM,OAAO,KAAM,SAAQ,IAAI;IAE7B,YAAY,GAAG,IAAe;QAC5B,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC;YAAG,KAAK,CAAE,GAAG,IAAgB,CAAE,CAAA;aAC9C,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAG;YAClE,MAAM,cAAc,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,cAAc,CAAE,IAAI,CAAC,GAAG,EAAE,CAAE,GAAG,EAAE,CAAA;YACnE,KAAK,CAAE,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,IAAgB,CAAC,CAAC,GAAG,cAAc,CAAE,CAAA;SAC3D;aAAI;YACH,KAAK,CAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAa,CAAE,CAAA;SACvC;IACH,CAAC;IAUD,SAAS,CAAC,YAAgB;QACxB,IAAI,CAAC,OAAO,CAAE,IAAI,CAAC,OAAO,EAAE,GAAG,YAAY,CAAE,CAAA;QAC7C,OAAO,IAAI,CAAA;IACb,CAAC;;AAXM,oBAAc,GAAG,CAAE,WAAoB,EAAG,EAAE;IACjD,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAA;IAC7B,IAAI,CAAC,WAAW;QAAG,OAAO,UAAU,CAAC,iBAAiB,EAAE,CAAA;IAExD,MAAM,YAAY,GAAG,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC,OAAO,EAAE,EAAC,QAAQ,EAAE,WAAW,EAAC,CAAE,CAAA;IACnF,OAAO,IAAI,CAAC,KAAK,CAAE,CAAE,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAE,GAAG,EAAE,CAAE,CAAA;AACzE,CAAC,CAAA;AASF,MAAc,CAAC,KAAK,GAAG,KAAK,CAAC"}
type MS = number
export const ms: MS = 1;
type SS = number
export const ss: SS = 1000;
type MM = number
export const mm: MM = ss * 60;
type HH = number
export const HH: HH = mm * 60;
type DateArgs= [any?, any?, any?, any?, any?, any?, any?]
type µDateArgs= [any?, any?, any?, any?, any?, any?, any?, string?]
export class µDate extends Date {
constructor(...args: µDateArgs){
if( args.length == 1 ) super( ...args as DateArgs )
else if( args.length > 1 && typeof args.slice(-1)[0] === 'string' ) {
const timeZoneOffset = -1 * µDate.timeZoneOffset( args.pop() ) * mm
super( (+new Date(...args as DateArgs)) + timeZoneOffset )
}else{
super( ...args.splice(7) as DateArgs )
}
}
static timeZoneOffset = ( timeZoneStr?: string ) => {
const localeDate = new Date()
if( !timeZoneStr ) return localeDate.getTimezoneOffset()
const tzDateString = (localeDate).toLocaleString('en-US', {timeZone: timeZoneStr} )
return Math.round( ( (+new Date(tzDateString)) - (+localeDate) ) / mm )
}
timeShift(milliseconds: MS){
this.setTime( this.getTime() + milliseconds )
return this
}
}
(global as any).µDate = µDate;