I have a requirement to format the date values shown in my PCF control (a dataset) in the UK format. Ideally, I would use the users specified display format for dates, and looking through the API documentation I found these two options, but of which should work:
context.formatting.formatutcdatetimetouserdate
and
context.formatting.formatdateshort
Unfortunately, neither of these options seem to work correctly.
When building the control, Visual Studio Code says that formatUTCDateTimeToUserDate doesn't exist, however when debugging the control in the browser I can inspect the context and see that this method is there. I have tried updating the CLI in Visual Studio Code (using pac install latest), and it seems the latest version of the CLI is installed.
When using formatdateshort if I specify the includeTime parameter as true, I get the following error at run time:
Uncaught (in promise) TypeError: e.getTime is not a function
at w (/uclient/scripts/app.js?v=1.4.3587-2111.3:2085)
at Function.ae [as formatShortDateTimeValue] (/uclient/scripts/app.js?v=1.4.3587-2111.3:2730)
at e.formatDateShort (/uclient/scripts/8.js?v=1.4.3587-2111.3:4)
at eval (webpack://pcf_tools_652ac3f36e1e4bca82eb3c1dc44e6fad/./CustomLookup/index.ts?:490)
at /uclient/scripts/app.js?v=1.4.3587-2111.3:709
at i (/uclient/scripts/app.js?v=1.4.3587-2111.3:308)
at a (/uclient/scripts/app.js?v=1.4.3587-2111.3:709)
Have I missed something or are these not working currently?