Hello community!
I have found some examples of how to format dates in a way that it aligns with the preferred date format of users in different countries. The classic example is the one comparing the order of day and month in the US versus in Europe. If we are tracking user locale as an attribute, we can do date formatting with liquid variables in the sql or html parameters of a formatted time dimension: https://www.googlecloudcommunity.com/gc/Technical-Tips-Tricks/Advanced-LookML-Liquid-Use-Cases/ta-p/....
Since we have many user locales each with its own preferred date format, this means we are going to need a very long case statement to generate a localised date format. That's okay if we were only expected to write it once, but the point here is that we actually want every single exposed date to be localised. Soon we start writing the same logic in multiple places. That's breaks the DRY principle of not repeat yourself, makes us prone to mistakes and makes it a hassle to add more preferred date formats or edit the existing logic overall.
Thus the question: is there a way to save and re-use the logic behind the preferred time format across the project?
Thank you,
Daniel