In short, I have built a very simple case builder in Apex/Visualforce where you select a case starting date (DateTime) and then it sets this value as the Estimated Start Date of the case (also DateTime field).
I live in Australia GMT 10+, and have applied this value to my variable so that when I begin the case builder the default start date value is set correctly by System.NOW().
The problem is that when I make the Estimated Start Date (field) = Start Date (apex variable) I lose the timezone, as you can see via the screenshot attached.
The first highlighted date time is the start date, which onchange refreshes the below section, applying the start date to the estimated start date of the case itself. As you can see it is losing the GMT10+ timezone and rolling back 10 hours.
I have read several posts with no clear solution to this issue (some really messy jquery hacks that I'd like to avoid if possible). Does anyone have a way of setting this value? (My orgs company profile is set to GMT10+, and business hours is used to calculated the SLAs which is also set to GMT10+ in case you were wondering).As far as code snippet goes there is a lot of stuff that has no relevance here. I have narrowed it down to the following scenario through testing
DateTime startdate = system.Now();
startdate.format('h:mm a', 'GMT+10:00')
case.Estimate_start_date__c = startdate