Click here to Skip to main content
15,895,656 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using moment.js to get the 2 dates those are the from and to to pass my method.

the date formats are working properly in Google chrome but not able to get those dates in IE browser.


Could you please help me on this how to fix.

I have tried but not able to do this.

What I have tried:

I have tried with the below code.

 this is For last 24 hours
var array = date.split('~');
           
         [2017-11-15 22:01:28 , 2017-11-16 22:01:28] Getting this from UI as array   
            var from = array[0];//2017-11-15 22:01:28
            var to = array[1];//2017-11-16 22:01:28

            var from = moment(from).format();
            to = moment(to).format();
            alert(from);

            combinddate = from + ' ~ ' + to;



Getting
"invalid date ~ 2017-11-16T17:53:01+05:30"

But my expected value should be like below
2017-11-15T17:53:01+05:30 ~ 2017-11-16T17:53:01+05:30
Posted
Updated 20-Nov-17 21:51pm
Comments
Karthik_Mahalingam 16-Nov-17 22:45pm    
does it parse properly in IE?
 moment(from) 

1 solution

Now i am able to get proper date by using the below line of code
moment(from, 'YYYY-MM-DDTHH:mm:ssZ').format()
 
Share this answer
 
Comments
Member 13133580 13-Feb-18 14:27pm    
excellent...!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900