1

I am displaying a ui:outputDateTime with the 'z' format option. I don't think it works. This is an example component:

<aura:component description="DateTimeTest">
    <ui:outputDateTime value="2017-06-13T23:42:06.000Z" format="MMM dd, yyyy hh:mm a z" timezone="America/Los_Angeles" />
</aura:component>

The above displays as: Jun 13, 2017 04:42 PM UTC Does that look right? I think it should display 'PDT' or am I missing something?

Thanks, Greg.

2

Can you potentially use lightning:formattedDateTime component instead? It seems to be handling timezones much better, for example below behaves as expected (at least in my browser):

<lightning:formattedDateTime value="2017-06-13T23:42:06.000Z" timeZone="America/Los_Angeles" year="numeric" month="2-digit" day="numeric" hour="numeric" minute="numeric"/>

Don't know if you can achieve the same formatting as you wanted with the ui:outputDateTime though. On the other hand lightning:formattedDateTime supports localisation out of the box, so it might benefit for multi country orgs.

0

Whatever date ui:outputDateTime displays is in GMT so you will have to set the timezone as per logged in User using Moment.js

  • I disagree. The 'value' attribute is in GMT (23:42). The display value is in my local timezone PDT (04:42 PM). My question is why is 4:42 PM being displayed with a UTC timezone when it is clearly not the same timezone as the 'value' attribute? – Greg Shaw Jun 18 '17 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.