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

jalali-moment

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jalali-moment - npm Package Compare versions

Comparing version 3.3.4 to 3.3.5

16

jalali-moment.js

@@ -587,2 +587,5 @@

}
if (moment.ISO_8601 === format) {
format = 'YYYY-MM-DDTHH:mm:ss.SSSZ';
}
const inputIsJalali = isInputJalali(format, this, input);

@@ -802,2 +805,15 @@ // var itsJalaliDate = (isJalali(this));

};
jMoment.fn.diff = function (input, unitOfTime) {
if (isJalali(this)) {
if (unitOfTime === 'd' || unitOfTime === 'day') {
return moment.fn.diff.call(this, input, unitOfTime);
} else if (unitOfTime === 'm' || unitOfTime === 'month') {
return Math.abs(this.jMonth() - input.jMonth());
} else if (unitOfTime === 'y' || unitOfTime === 'year') {
return Math.abs(this.jYear() - input.jYear());
}
} else {
return moment.fn.diff.call(this, input, unitOfTime);
}
};

@@ -804,0 +820,0 @@ jMoment.fn.dayOfYear = function (input) {

2

package.json
{
"name": "jalali-moment",
"version": "3.3.4",
"version": "3.3.5",
"description": "Manipulate and convert Jalali and Gregorian date easily",

@@ -5,0 +5,0 @@ "author": {

@@ -1170,10 +1170,19 @@

});
describe("test diff", function () {
describe("jmoment vs moment", function () {
it("ISO_8601", function () {
//https://github.com/fingerpich/jalali-moment/issues/70
const d1 = moment('2019-10-26', moment.ISO_8601).format();
const d2 = jalaliMoment('2019-10-26', moment.ISO_8601).format();
d1.should.be.equal(d2);
});
it("diff locale fa", function () {
//https://github.com/fingerpich/jalali-moment/issues/78
const d1 = moment('2019-10-26').locale('fa').diff(moment('2019-10-28').locale('fa'), 'month')
const d2 = moment('2019-10-26').locale('en').diff(moment('2019-10-28').locale('en'), 'month')
const d1 = jalaliMoment('2019-10-26').locale('fa').diff(jalaliMoment('2019-10-28').locale('fa'), 'month');
const d2 = jalaliMoment('2019-10-26').locale('en').diff(jalaliMoment('2019-10-28').locale('en'), 'month');
const d3 = moment('2019-10-26').diff(moment('2019-10-28'), 'month');
d1.should.be.equal(d2);
d2.should.be.equal(d3);
});
});
});
``

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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