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.

0

2 Answers 2

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

1
  • 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
    Commented Jun 18, 2017 at 15:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .