Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jin-time

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jin-time - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

59

index.env=web.stage=release.js

@@ -197,3 +197,3 @@ var $jin = this.$jin = {}

duration_class.prototype.valueOf = function () {
var day = this.year * 365 + this.month * 30 + this.day;
var day = this.year * 365 + this.month * 30.4 + this.day;
var second = ((day * 24 + this.hour) * 60 + this.minute) * 60 + this.second;

@@ -465,2 +465,27 @@ return second * 1000;

};
moment_class.prototype.sub = function (config) {
var Moment = this.constructor;
var moment = Moment.make(config);
var dur = {
year: (moment.year === void 0)
? this.year
: (this.year || 0) - moment.year,
month: (moment.month === void 0)
? this.month
: (this.month || 0) - moment.month,
day: (moment.day === void 0)
? this.day
: (this.day || 0) - moment.day,
hour: (moment.hour === void 0)
? this.hour
: (this.hour || 0) - moment.hour,
minute: (moment.minute === void 0)
? this.minute
: (this.minute || 0) - moment.minute,
second: (moment.second === void 0)
? this.second
: (this.second || 0) - moment.second,
};
return new Moment.duration_class(dur);
};
moment_class.prototype.toOffset = function (duration) {

@@ -659,4 +684,4 @@ if (this._offset) {

var Range = this.constructor;
this._from = config.from && Range.Moment.make(config.from);
this._to = config.to && Range.Moment.make(config.to);
this._start = config.start && Range.Moment.make(config.start);
this._end = config.end && Range.Moment.make(config.end);
this._duration = config.duration && Range.Duration.make(config.duration);

@@ -670,9 +695,9 @@ }

var config = {};
config[/^P/i.test(chunks[0]) ? 'duration' : 'from'] = chunks[0];
config[/^P/i.test(chunks[1]) ? 'duration' : 'to'] = chunks[1];
config[/^P/i.test(chunks[0]) ? 'duration' : 'start'] = chunks[0];
config[/^P/i.test(chunks[1]) ? 'duration' : 'end'] = chunks[1];
return this.make(config);
case 'Array':
return new this({
from: range[0],
to: range[1],
start: range[0],
end: range[1],
duration: range[2],

@@ -688,8 +713,8 @@ });

};
Object.defineProperty(range_class.prototype, "from", {
Object.defineProperty(range_class.prototype, "start", {
get: function () {
if (this._from)
return this._from;
if (this._start)
return this._start;
var Range = this.constructor;
return this._from = this._to.shift(Range.Duration.make().sub(this._duration));
return this._start = this._end.shift(Range.Duration.make().sub(this._duration));
},

@@ -699,7 +724,7 @@ enumerable: true,

});
Object.defineProperty(range_class.prototype, "to", {
Object.defineProperty(range_class.prototype, "end", {
get: function () {
if (this._to)
return this._to;
return this._to = this._from.shift(this._duration);
if (this._end)
return this._end;
return this._end = this._start.shift(this._duration);
},

@@ -714,3 +739,3 @@ enumerable: true,

var Range = this.constructor;
return this._duration = Range.Duration.make(this._to.valueOf() - this.from.valueOf());
return this._duration = Range.Duration.make(this._end.valueOf() - this.start.valueOf());
},

@@ -722,3 +747,3 @@ enumerable: true,

range_class.prototype.toString = function () {
return (this._from || this._duration).toString() + '/' + (this._to || this._duration).toString();
return (this._start || this._duration).toString() + '/' + (this._end || this._duration).toString();
};

@@ -725,0 +750,0 @@ range_class.Moment = $jin.time.moment_class;

{
"name": "jin-time",
"description": "Cool date/time/duration/range arithmetic",
"version": "1.0.3",
"version": "1.1.0",
"authors": [

@@ -6,0 +6,0 @@ "jin <nin-jin@ya.ru>"

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