There is a time field in Salesforce Attendee_Arrival_Time__c.
When querying in apex it is displaying time as 01:49:00.000Z and due to that it is not populating time in visualforce <apex:input type='time'/> tag.
I want to display it in Time only and not in String format.
Please help!
<apex:input type="time" id="arrivalTime" value="{!arrivalTime}" />
Best Answer
This is a change in Spring '22 where Time is now rendered, when converted to string to populate an apex:input value attribute, as hh:mm:ss.sssZ, instead of hh:mm as it is up to Winter '22. Identified as a regression bug by Salesforce R&D: see later.
To work around this, before a fix is available, you will need to work around this by updating your Apex controller to use String instead of Time and handle the conversion between the two for yourself.
From Time to String:
From String to Time:
Use the String to populate the input and to receive the inputs updated value and handle the conversion as needed to/from the Time field in the controller. You can, I believe, keep the use of input type "time".
Note that one option is to still have the Time properties, but don't use them in the page, just in the controller. You can then:
The page is updated to use the equivalent String property instead of the Time property.
Total PITA. Will update if I get an answer as to if this is a bug or not.
UPDATE:
I have raised this as a Partner Support Case (#41955625) and await a response.
The following is a minimum viable reproduction:
Controller:
Page (TimeIsBroken.page):
For Winter '22 this page renders as follows:
On the other hand Spring '22 renders like this:
I ran the first on a Scratch org for Winter '22, and the second on a Scratch org for Spring '22, just setting the "release" property in the
config/project-scratch-def.json
.FURTHER UPDATE
I am told by support that this is caused by this known issue which will be fixed by Salesforce's bug fix W-10436600. No idea of delivery timescales at this point.
(HOPEFULLY) FINAL UPDATE
From Salesforce Support: