Based on my reading of the documentation that includes statements like this:
When using the component to display a date only, without time, include time-zone="UTC" to ensure the correct date displays in all time zones.
I would expect this:
<lightning-formatted-date-time value="2020-07-07T00:00:00Z" time-zone="UTC">
to always output Jul 7, 2020
. But when I change the timezone on my Mac, the date can jump back to Jul 6, 2020
. Note that that is not consistent with this next piece of documentation either as it is my browser's time zone that is being responded to not my user's time zone in Salesforce:
When no attributes other than value are specified, the component uses the default date format based on the user's locale in Salesforce.
What am I missing here?
PS
My colleague Cesar-Garcia has done dome more work on this in response to sfcbweb and has this to share...
I’ve tested the following template, displaying the same timestamp both, as a date and as a the full date+time:
<template> <p><lightning-formatted-date-time value="2020-07-07T00:00:00Z" time-zone="UTC" ></lightning-formatted-date-time> </p> <p> <lightning-formatted-date-time value="2020-07-07T00:00:00Z" year="numeric" month="numeric" day="numeric" hour="2-digit" minute="2-digit" time-zone-name="short" hour12="true" time-zone="UTC" ></lightning-formatted-date-time> </p> </template>
When setting my timezone to China - Mainland (UTC+7), I get the following output, where the date only output is shifted:
so the problem appears to be in the default conversion to date only.