Hello, I am trying to compare 2 dates and I keep o...
# suitescript
p
Hello, I am trying to compare 2 dates and I keep on getting false for my if statement. What do I need to do to fix it? My code is parseFloat(responseDate.getTime()) - parseFloat(ratiodate.getTime())) > 0
s
Log them individually and see what they are
s
you also shouldn't need to
parseFloat
since the output of those calls should be numbers already
p
I get a null when subtracting the 2:
what am I doing wrong
s
Assuming they are are both actually dates and getTime() is not the problem... they are already numbers, stop parsing them as shawn suggested
s
you probably need to share your actual code to get more detailed help
p
I figured it out. is there a way to prevent this variable to drop the decimal after the 5?
ratiodate = 5.0;
s
I think calling
getTime()
should return an integer, assuming ratiodate is actually a date object.
p
got it. thank you.