I am new to angular 6 ,Here I need to compare to date inputs and find the greatest one.
input 1 : 2018-12-29T00:00:00
input 2 : Mon Dec 31 2018 00:00:00 GMT+0530 (India Standard Time)
Here I received the input 1 from mssql database and the input 2 from the material datepicker .
while compare this two dates as below I got false.
console.log(mMagazineObject.From < mMagazineObject.To ? true : false);
is there any possibility to compare these two date formats .If yes please help me to fix this .
you can use getTime
if (input1Date.getTime() < input2Date.getTime())
Note that if your dates are in string format, you first need to parse them to Date
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With