Format date/DateTime using the Aura Localization Service
The localization service of the Aura components takes care of providing localization support to the client-side JavaScript input and output. In this section, we will cover a few of the functions provided by the localization service. For a comprehensive list of the functions supported, refer to the official documentation at https://<myDomain>/auradocs/reference.app#reference?topic=api:AuraLocalizationService
. Here, myDomain
is the custom domain name of your organization.
Find your organization's time zone
To find the local time zone of the running user, copy the following snippet of code into your component JavaScript:
var OrgtimeZone = $A.get("$Locale.timezone");
Find your organization's local currency
To find the local currency, copy the following snippet of code in your component's JavaScript:
var Orgcurrency = $A.get("$Locale.currency");
Formatting dates
To understand how to format dates, let's copy the following code files into...