New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

timezoned-date

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timezoned-date - npm Package Compare versions

Comparing version 2.0.7 to 2.0.8

.babelrc

154

lib/index.js
'use strict';
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true
});
var _bind = Function.prototype.bind;
var _slice = Array.prototype.slice;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(_x3, _x4, _x5) { var _again = true; _function: while (_again) { var object = _x3, property = _x4, receiver = _x5; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x3 = parent; _x4 = property; _x5 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var MILLISECONDS_PER_MINUTE = 60 * 1000,

@@ -22,4 +22,7 @@ OFFSET_SUFFIX = /(((GMT)?[\+\-]\d\d:?\d\d)|Z)(\s*\(.+\))?$/,

function makeConstructor() {
var _Object$definePropert;
var defaultOffset = arguments.length <= 0 || arguments[0] === undefined ? -new OriginalDate().getTimezoneOffset() : arguments[0];
// If the resulting constructor is "bound",

@@ -33,6 +36,8 @@ // - it's signature is compatible with built-in Date,

var TimezonedDate = (function (_OriginalDate) {
var TimezonedDate = function (_OriginalDate) {
_inherits(TimezonedDate, _OriginalDate);
function TimezonedDate() {
var _Object$getPrototypeO;
_classCallCheck(this, TimezonedDate);

@@ -45,10 +50,13 @@

var offset = bound ? defaultOffset : args.pop();
_get(Object.getPrototypeOf(TimezonedDate.prototype), 'constructor', this).apply(this, args);
var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(TimezonedDate)).call.apply(_Object$getPrototypeO, [this].concat(args)));
if (!isOffset(offset)) {
throw new TypeError('TimezonedDate requires an offset');
}
this.setTime(buildDate(args, offset));
this.offset = function () {
_this.setTime(buildDate(args, offset));
_this.offset = function () {
return offset;
};
return _this;
}

@@ -59,2 +67,3 @@

_createClass(TimezonedDate, [{

@@ -118,2 +127,3 @@ key: '_localDate',

// https://nodejs.org/api/util.html#util_custom_inspect_function_on_objects
}, {

@@ -127,16 +137,20 @@ key: 'inspect',

return TimezonedDate;
})(OriginalDate);
}(OriginalDate);
var proto = TimezonedDate.prototype;
function addGetters(property) {
Object.defineProperty(TimezonedDate.prototype, 'get' + property, {
value: function value() {
return this._localDate()['getUTC' + property]();
},
var getterName = 'get' + property,
utcGetterName = 'getUTC' + property;
Object.defineProperty(proto, getterName, {
value: createFunction(function () {
return this._localDate()[utcGetterName]();
}, 0, getterName),
configurable: true,
writable: true
});
Object.defineProperty(TimezonedDate.prototype, 'getUTC' + property, {
value: function value() {
return this.date()['getUTC' + property]();
},
Object.defineProperty(proto, utcGetterName, {
value: createFunction(function () {
return this.date()[utcGetterName]();
}, 0, utcGetterName),
configurable: true,

@@ -150,17 +164,19 @@ writable: true

Object.defineProperty(TimezonedDate.prototype, 'set' + property, {
value: fixLength(function () {
var setterName = 'set' + property,
utcSetterName = 'setUTC' + property;
Object.defineProperty(proto, setterName, {
value: createFunction(function () {
var localDate = this._localDate();
localDate['setUTC' + property].apply(localDate, arguments);
localDate[utcSetterName].apply(localDate, arguments);
return this.setTime(applyOffset(localDate, -this.offset()));
}, length),
}, length, setterName),
configurable: true,
writable: true
});
Object.defineProperty(TimezonedDate.prototype, 'setUTC' + property, {
value: fixLength(function () {
Object.defineProperty(proto, utcSetterName, {
value: createFunction(function () {
var date = this.date();
date['setUTC' + property].apply(date, arguments);
date[utcSetterName].apply(date, arguments);
return this.setTime(date);
}, length),
}, length, utcSetterName),
configurable: true,

@@ -187,2 +203,39 @@ writable: true

Object.defineProperties(proto, (_Object$definePropert = {}, _defineProperty(_Object$definePropert, Symbol.toStringTag, {
value: 'Date'
}), _defineProperty(_Object$definePropert, Symbol.toPrimitive, {
value: OriginalDate.prototype[Symbol.toPrimitive],
configurable: true
}), _Object$definePropert));
var ownPropsOfProto = ['toTimeString', 'toLocaleString', 'toLocaleDateString', 'toDateString', 'toLocaleTimeString', 'toUTCString'];
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = ownPropsOfProto[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var prop = _step.value;
Object.defineProperty(proto, prop, {
value: OriginalDate.prototype[prop],
configurable: true,
writable: true
});
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
var _TimezonedDate = function _TimezonedDate(_a1, _a2, _a3, _a4, _a5, _a6, _a7) {

@@ -197,8 +250,41 @@ if (!(this instanceof _TimezonedDate)) {

}
return new (_bind.apply(TimezonedDate, [null].concat(_slice.call(arguments))))();
return new (Function.prototype.bind.apply(TimezonedDate, [null].concat(Array.prototype.slice.call(arguments))))();
};
_TimezonedDate.prototype = TimezonedDate.prototype;
_TimezonedDate.prototype.constructor = _TimezonedDate;
Object.defineProperty(_TimezonedDate, 'prototype', {
value: proto,
writable: false,
configurable: false
});
proto.constructor = _TimezonedDate;
Object.setPrototypeOf(_TimezonedDate, TimezonedDate);
var ownPropsOfCtor = ['UTC', 'parse'];
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = ownPropsOfCtor[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var _prop = _step2.value;
Object.defineProperty(_TimezonedDate, _prop, {
value: OriginalDate[_prop],
configurable: true,
writable: true
});
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
return _TimezonedDate;

@@ -271,3 +357,3 @@ }

function fixLength(fn, length) {
function createFunction(fn, length, name) {
var argNames = [];

@@ -277,3 +363,3 @@ for (var i = 0; i < length; i++) {

}
return eval('(function(' + argNames.join(',') + ') { return fn.apply(this, arguments); })');
return eval('(function ' + name + '(' + argNames.join(',') + ') { return fn.apply(this, arguments); })');
}

@@ -283,3 +369,3 @@

ExportedTimezonedDate.makeConstructor = makeConstructor;
exports['default'] = ExportedTimezonedDate;
exports.default = ExportedTimezonedDate;
module.exports = exports['default'];
{
"name": "timezoned-date",
"version": "2.0.7",
"version": "2.0.8",
"license": "Apache-2.0",

@@ -8,5 +8,8 @@ "description": "Work with timezone-aware dates",

"date",
"isomorphic",
"jsdom",
"mock",
"server-side-rendering",
"timezone",
"utc",
"jsdom"
"utc"
],

@@ -23,7 +26,9 @@ "contributors": [

"devDependencies": {
"babel": "^5.8.23",
"babel-eslint": "^4.1.3",
"eslint": "^1.5.0",
"mocha": "~1.9.0",
"test262-harness": "^1.5.5"
"babel-cli": "^6.5.2",
"babel-eslint": "^6.0.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-es2015": "^6.9.0",
"eslint": "^2.10.2",
"mocha": "~2.4.5",
"test262-harness": "^1.5.6"
},

@@ -38,5 +43,5 @@ "scripts": {

"prepublish": "npm run build",
"build": "babel --optional es7.classProperties,es7.decorators src --out-dir lib",
"watch": "babel --optional es7.classProperties,es7.decorators src --watch --out-dir lib"
"build": "babel src --out-dir lib",
"watch": "babel src --out-dir lib --watch"
}
}

@@ -25,4 +25,7 @@ # Timezoned Date

Known issue: [daylight saving time support](https://github.com/jamesarosen/date-with-offset/pull/1).
Known issues:
* [daylight saving time support](https://github.com/jamesarosen/date-with-offset/pull/1).
* Milliseconds are zeroed if you do `new Date(tzDate)` where `Date` is the original native `Date`, `tzDate` is an instance of `TimezonedDate`.
*README TBD*

@@ -29,0 +32,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc