Timeline for Lightning Component - Date formatting not consistent with standard UI
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 18, 2018 at 12:21 | comment | added | Jayant Das | I haven't really tried much on this, but looking at the documentation it seems there are ways to achieve this. | |
Sep 18, 2018 at 12:12 | comment | added | Homerlex | Dang, I just noticed that when I use lightning:formattedDateTime the date is rendered 1 day behind the actual date. Some other thread suggested add timeZone="UTC" to the formatting and that seems to fix it but date formatting in lightning seems all kinds of messed up. And to confirm, I am outputting a Date object not a DateTime object. | |
Sep 18, 2018 at 11:20 | comment | added | Homerlex | If I specify the format like the following it works but I would expect the default format to match the standard UI's format: <lightning:formattedDateTime value="{!v.benefitList[0].ExpirationDate__c}" year="numeric" month="numeric" day="numeric" /> | |
Sep 18, 2018 at 11:15 | comment | added | Homerlex | Thanks for the suggestion but lightning:formattedDateTime outputs the the same wrong format - "Sep 17, 2018". Am I the only one seeing this? | |
Sep 17, 2018 at 20:11 | history | edited | Jayant Das | CC BY-SA 4.0 |
added 498 characters in body
|
Sep 17, 2018 at 20:08 | comment | added | Jayant Das | If you want to use locale, then you should instead use lightning:formattedDateTime | |
Sep 17, 2018 at 20:06 | comment | added | Homerlex | But what about different locales? I should not have to hardcode the format. If I switch my local to English UK the format should be DD/MM/YYYY. These are things we don't have to worry about in VisualForce pages. | |
Sep 17, 2018 at 19:58 | history | answered | Jayant Das | CC BY-SA 4.0 |