You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
jMoment fails when called with an array as input
To Reproduce
MJ = new jMoment ([1398,4,6,13,9,8,0])
Expected behavior
create related object like moment itself
Additional context
I have changed the library alot for my propose in another repo, I post here my resolution not sure if it should be merged as is:
functionmakeMoment(input,format,lang,strict,utc){//...if(isArray(input)){if(input[0]!==latinNumber(input[0])){// pmn: if it uses persian number assume it is persian (problem in this.utc)itsJalaliDate=true;input=input.map(latinNumber);}input=input.map(x=>parseInt(x,10));}if(input&&isArray(input)&&!format&&itsJalaliDate&&!moment0.useGregorianParser){input=input[0]+"-"+(input[1]+1)+"-"+input[2]+" "+input[3]+":"+input[4]+":"+input[5]+"."+leftZeroFill(input[6],3);if(!format)format="jYYYY-jM-jD H:m:s.SSS"}//...
The text was updated successfully, but these errors were encountered:
Yes because as I said before I have changed the code a lot, one of them is that in my fork the months are 0 based. This is the reason that I didn't create PR, but issue. I added the snippet as a suggestion.
Anyway, if this is the only problem, just remove +1 from (input[1] + 1)
Describe the bug
jMoment fails when called with an array as input
To Reproduce
MJ = new jMoment ([1398,4,6,13,9,8,0])
Expected behavior
create related object like moment itself
Additional context
I have changed the library alot for my propose in another repo, I post here my resolution not sure if it should be merged as is:
The text was updated successfully, but these errors were encountered: