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.2.5 to 3.2.6

1

jalali-moment.d.ts

@@ -123,2 +123,3 @@ declare function moment(inp?: moment.MomentInput, format?: moment.MomentFormatSpecification, strict?: boolean): moment.Moment;

interface LocaleSpecification {
useGregorianParser?: boolean;
months?: string[] | StandaloneFormatSpec | MonthWeekdayFn;

@@ -125,0 +126,0 @@ monthsShort?: string[] | StandaloneFormatSpec | MonthWeekdayFn;

13

jalali-moment.js

@@ -576,3 +576,3 @@

var itsJalaliDate = (isJalali(this));
if(input && (typeof input === "string") && !format && itsJalaliDate) {
if(input && (typeof input === "string") && !format && itsJalaliDate && !moment.useGregorianParser) {
input = input.replace(/\//g,"-");

@@ -966,6 +966,6 @@ if(/\d{4}\-\d{2}\-\d{2}/.test(input)) {

************************************/
jMoment.locale = function(locale) {
jMoment.locale = function(locale, options) {
if (locale && moment.changeCalendarSystemByItsLocale) {
if (locale === "fa") {
this.useJalaliSystemPrimarily();
this.useJalaliSystemPrimarily(options);
} else {

@@ -994,4 +994,9 @@ this.useJalaliSystemSecondary();

jMoment.useJalaliSystemPrimarily = function () {
jMoment.useJalaliSystemPrimarily = function (options) {
moment.justUseJalali = true;
useGregorianParser = false;
if (options) {
useGregorianParser = options.useGregorianParser;
}
moment.useGregorianParser = useGregorianParser;
};

@@ -998,0 +1003,0 @@ jMoment.useJalaliSystemSecondary = function () {

{
"name": "jalali-moment",
"version": "3.2.5",
"version": "3.2.6",
"description": "Manipulate and convert Jalali and Gregorian date easily",

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

@@ -1129,2 +1129,13 @@

});
describe("use gregorian calendar parser in 'fa' locale", function () {
it("use jalali calendar when useGregorianParser is false in fa locale", function () {
moment.locale("fa", { useGregorianParser: false });
moment("1370-10-17").format("YYYY-MM-DD").should.be.equal("1370-10-17");
});
it("parse using gregorian calendar in fa locale", function () {
moment.locale("fa", { useGregorianParser: true });
moment("2019-01-17T08:19:19.975Z").format("YYYY-MM-DD").should.be.equal("1397-10-27");
moment("2019-02-23").format("YYYY-MM-DD").should.be.equal("1397-12-04");
});
});
});

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