Hi Team, Is there any method available to format d...
# gooddata-ui
j
Hi Team, Is there any method available to format date using locale and date attribute Granularity as specified in documentation https://www.gooddata.com/docs/cloud/customize-appearance/change-date-format/ ? I am using SDK UI version 9.0.1
Screenshot 2023-10-20 at 5.22.22 PM.png
m
Hi Jitender, to change the locale you’re using, you need to pass the “locale” property with one of the options here: https://github.com/gooddata/gooddata-ui-sdk/blob/master/libs/sdk-ui/src/base/localization/Locale.ts For changing what the range of the Date is, you can use the granularity passed down from the catalog (for example, “Aug 2021" should correspond to
<your-data>.DateDatasets.Date.MonthYear.Short
)
j
Hi @Michael Ullock Actually i need to get all the date formats shown in above screenshot. is there any method exposed for the same?
m
@Radek Novacek Might you have some idea here please?
👀 1
r
Hi @Jitender Singh 🙂 Radek from the GoodData technical team here - to clarify this a little bit, are you trying to get the list of all the date formats actually displayed, or trying to figure out which date formats you're able to use? The SDK allows you to specify the granularity using the
DateDatasets
in your catalog export - the easiest way to figure out what display form is available for your Date Attribute is to check
/src/catalog.ts
.