Hi Experts, We have ActualStartDate field on Form and onLoad we are setting today date using JS to this field. Below is the code snippet.
PC Timezone - IST
CRM Logged in User Timezone - EST
Issue: Date() object is taking System DateTime which is in IST and while storing the date in UTC in Database, CRM System using EST which is CRM logged in User TimeZone to deduct/add hours based on timezone offset instead of IST.
Example:
System Current DateTime: 4/2/2019 12:22 PM IST
Date() object Time: 4/2/2019 12:22 PM IST
SQL DB field DateTime UTC: 4/2/2019 17:22 PM [Date() + 5 hours EST(UTC-5)]
Solution Proposed to Business:-
- Keep CRM Logged in user TimeZone and PC Timezone same. [This will not ensure 100% result as some user might have different timezone]
- Execute Custom Action from onLoad JS and update ActualStartDate from c# code [Performance impact on form load as it was taking more than 1 mins to update the record]
- tried converting Date() to UTC in JS but didn't work.
Please provide your inputs. Thanks in Advance!