I have a custom “date” field in my schema in ISO86...
# community-help
a
I have a custom “date” field in my schema in ISO8601 format. I want to display this date field in various formats (US vs. DE format) - depending on the site. What is the best way for transforming such a field on-the-fly from ISO8601 to something? Is this something that could be accomplished using the “helpers.” module?
k
Typesense does not have a date datatype. You will have to store dates as unix timestamps and then do the formatting on the client side during display.
a
The “date” field is a string field in ISO8601 format..it is should 1:1 in the result so far. The question is how to convert the ISO8601 string on-the-fly while rendering to another format.
k
How are the results being rendered? Javascript?
a
`widget.hits`` contains something like this (for `templates`:
Copy code
<span class="hit-modified">{{#helpers.highlight}}{ "attribute": "modified" }{{/helpers.highlight}}</span>
k
Got it. I will get back to you on this.
a
no problem
j
@A J You want to use JS-based templates in the widget like this and then you should be able to use regular JS to transform the date format as needed.