function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rafael Martins Dos SantosRafael Martins Dos Santos 

lightning component ui-DateTime - How corret the time zone

Hi,
I added a field ui:inputDateTime in my lightning component but when I select the time, I have as value the different time zone.

User-added image
I Want convert this time to my time zone (Brasil).
Can someone help me to fix this?

Rafael.
 
RbnRbn
Hi Rafel,

Please go through the below link.

https://developer.salesforce.com/docs/component-library/bundle/ui:inputDateTime/example

Let me know if it helps .

Cheers,
Rabindranath
Raj VakatiRaj Vakati
You need to use   $locale.timezone


The $Locale global value provider returns information about the current user’s preferred locale. You can try using $locale.timezone in Aura to get the time zone and perhaps use it along with new Date to get the Date similar to the current loggged in user's timezone.

Refer this link

https://salesforce.stackexchange.com/questions/175573/how-to-get-current-date-as-per-logged-in-user-in-lightning-component

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/expr_locale_value_provider.htm
https://developer.salesforce.com/forums/?id=906F00000008zv0IAA
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_l10n.htm
Rafael Martins Dos SantosRafael Martins Dos Santos
Thanks for reply.

Raj Vakati, Do you have some example of how to use this !$Locale.timezone.
Because I want get the time value from a field and convert to my current time zone.
All the exemple that I found just tell how to get the current time, and not the value from a field.