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.0.9 to 3.0.10

18

jalali-moment.js

@@ -168,4 +168,4 @@

**/
function normalizeUnits(units) {
if(isJalali(this)){
function normalizeUnits(units, momentObj) {
if (isJalali(momentObj)) {
units = toJalaliUnit(units);

@@ -819,3 +819,3 @@ }

}
units = normalizeUnits(units);
units = normalizeUnits(units, this);
if (units === "jyear") {

@@ -838,3 +838,3 @@ this.jYear(this.jYear() + val);

}
units = normalizeUnits(units);
units = normalizeUnits(units, this);
if (units === "jyear") {

@@ -851,3 +851,3 @@ this.jYear(this.jYear() - val);

jMoment.fn.startOf = function (units) {
units = normalizeUnits(units);
units = normalizeUnits(units, this);
if( units === "jweek"){

@@ -872,3 +872,3 @@ return this.startOf("day").subtract(this.jDay() , "day");

jMoment.fn.endOf = function (units) {
units = normalizeUnits(units);
units = normalizeUnits(units, this);
if (units === undefined || units === "milisecond") {

@@ -881,3 +881,3 @@ return this;

jMoment.fn.isSame = function (other, units) {
units = normalizeUnits(units);
units = normalizeUnits(units, this);
if (units === "jyear" || units === "jmonth") {

@@ -890,3 +890,3 @@ return moment.fn.isSame.call(this.clone().startOf(units), other.clone().startOf(units));

jMoment.fn.isBefore = function (other, units) {
units = normalizeUnits(units);
units = normalizeUnits(units, this);
if (units === "jyear" || units === "jmonth") {

@@ -899,3 +899,3 @@ return moment.fn.isBefore.call(this.clone().startOf(units), other.clone().startOf(units));

jMoment.fn.isAfter = function (other, units) {
units = normalizeUnits(units);
units = normalizeUnits(units, this);
if (units === "jyear" || units === "jmonth") {

@@ -902,0 +902,0 @@ return moment.fn.isAfter.call(this.clone().startOf(units), other.clone().startOf(units));

@@ -24,3 +24,2 @@ # Jalali Moment

- [Aurelia](https://github.com/fingerpich/jalali-moment#aurelia)
- [Vue](https://github.com/fingerpich/jalali-moment#vue)
- [Es5](https://github.com/fingerpich/jalali-moment#es5)

@@ -39,23 +38,22 @@ - [Plunker](https://github.com/fingerpich/jalali-moment#using-in-plunker)

- [Parse](#parse)
- [Parse](https://github.com/fingerpich/jalali-moment#parse)
```js
moment.locale('fa'); // set fa locale for all new moment instances
var m1 = moment("1367/11/04");
var m1 = moment("1367/11/04","YYYY/MM/DD");
```
- [Display](#display-jalali-or-miladi-date)
- [Display](https://github.com/fingerpich/jalali-moment#display-jalali-or-miladi-date)
```js
m1.format("YYYY/MM/DD"); // 1367/11/04
```
- [Manipulate](#manipulate)
- [Manipulate](https://github.com/fingerpich/jalali-moment#manipulate)
```js
m1.add(1, "day").format("YYYY/MM/DD"); // 1367/11/05
```
- [Validate](#validate)
- [Validate](https://github.com/fingerpich/jalali-moment#validate)
```js
m1.isSame(m1.clone()); // true
```
- [Convert](#convert-persianjalali--shamsi-khorshidi-to-gregorian-miladi-calendar-system)
- [Convert](https://github.com/fingerpich/jalali-moment#convert-persianjalali--shamsi-khorshidi-to-gregorian-miladi-calendar-system)
```js
moment.locale('fa');
moment('1367/11/04').locale('en').format('YYYY/MM/DD'); // 1989/01/24
moment('1367/11/04', 'YYYY/MM/DD').locale('en').format('YYYY/MM/DD'); // 1989/01/24
moment.locale('en');

@@ -62,0 +60,0 @@ moment('1989/01/24').locale('fa').format('YYYY/MM/DD'); // 1367/11/04

{
"name": "jalali-moment",
"version": "3.0.9",
"version": "3.0.10",
"description": "Display, parse, manipulate ,validate and convert jalali (Persian, Khorshidi, Shamsi) date and time",

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

@@ -24,3 +24,2 @@ # Jalali Moment

- [Aurelia](#aurelia)
- [Vue](#vue)
- [Es5](#es5)

@@ -171,10 +170,3 @@ - [Plunker](#using-in-plunker)

#### Vue
Use [vue-jalali-moment](https://github.com/fingerpich/vue-jalali-moment) library
```html
<span>{{ someDate | moment("dddd, MMMM Do YYYY") }}</span>
```
## API

@@ -181,0 +173,0 @@

@@ -24,3 +24,2 @@ # Jalali Moment

- [Aurelia](https://github.com/fingerpich/jalali-moment#aurelia)
- [Vue](https://github.com/fingerpich/jalali-moment#vue)
- [Es5](https://github.com/fingerpich/jalali-moment#es5)

@@ -39,23 +38,22 @@ - [Plunker](https://github.com/fingerpich/jalali-moment#using-in-plunker)

- [Parse](#parse)
- [Parse](https://github.com/fingerpich/jalali-moment#parse)
```js
moment.locale('fa'); // set fa locale for all new moment instances
var m1 = moment("1367/11/04");
var m1 = moment("1367/11/04","YYYY/MM/DD");
```
- [Display](#display-jalali-or-miladi-date)
- [Display](https://github.com/fingerpich/jalali-moment#display-jalali-or-miladi-date)
```js
m1.format("YYYY/MM/DD"); // 1367/11/04
```
- [Manipulate](#manipulate)
- [Manipulate](https://github.com/fingerpich/jalali-moment#manipulate)
```js
m1.add(1, "day").format("YYYY/MM/DD"); // 1367/11/05
```
- [Validate](#validate)
- [Validate](https://github.com/fingerpich/jalali-moment#validate)
```js
m1.isSame(m1.clone()); // true
```
- [Convert](#convert-persianjalali--shamsi-khorshidi-to-gregorian-miladi-calendar-system)
- [Convert](https://github.com/fingerpich/jalali-moment#convert-persianjalali--shamsi-khorshidi-to-gregorian-miladi-calendar-system)
```js
moment.locale('fa');
moment('1367/11/04').locale('en').format('YYYY/MM/DD'); // 1989/01/24
moment('1367/11/04', 'YYYY/MM/DD').locale('en').format('YYYY/MM/DD'); // 1989/01/24
moment.locale('en');

@@ -62,0 +60,0 @@ moment('1989/01/24').locale('fa').format('YYYY/MM/DD'); // 1367/11/04

@@ -976,3 +976,13 @@

});
//TODO: var m1 = moment("1367/11/04");
describe("#add or subtract when global locale is not as we expected", function () {
it("instance locale and clone", function () {
moment.locale("en");
var m1 = moment("1395/12/30","jYYYY/jMM/jDD").locale("fa");
m1.format("YYYY/MM/DD").should.be.equal("1395/12/30");
m1.subtract(1, "month");
m1.format("YYYY/MM/DD").should.be.equal("1395/11/30");
});
});
});

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

Sorry, the diff of this file is not supported yet

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

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