-
I'm new to HTML handlebars and I'm trying to use it to format the dates in my PnP - Search Results web part but with no luck. By default, the date is displayed like this: 2024-06-19T04:00:00Z Does anyone know how to format the date so it displays like this instead: 19 June 2024 I've tried using each of the lines below but the date column goes blank:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Found the answer here: microsoft-search/pnp-modern-search#3468 This is the syntax I used and it worked! |
Beta Was this translation helpful? Give feedback.
-
For anyone else having this issue, there's useful guidance on the PnP Modern Search - Templating page for the getDate Handlebar helper. It's also worth referencing the Moment.js documentation that contains information on the string format. I suspect that the key issue in the example given was the use of the double quote character (") to format the date rather then the single quote ('). If this was within a string segment, it likely caused an error which the webpart resolves but not displaying anything. |
Beta Was this translation helpful? Give feedback.
Found the answer here: microsoft-search/pnp-modern-search#3468
This is the syntax I used and it worked!
{{getDate item.RefinableDate17 'DD MMMM yyyy' 0 true}}