Hi everyone. I want to compare two date fields, an...
# suitescript
k
Hi everyone. I want to compare two date fields, and if they're different update the second one to match the first. I've got
if (firstDate != secondDate) { doStuff(); }
but it always evaluates to true, even when they're the same date. What is the best way to compare dates in SuiteScript?
j
Quite tricky in SuiteScript 2.0, since it returns date objects, and if you're comparing a date retrieved/produced in a client script to one retrieved/produced in a server script, they may have different time zones.