I am creating a custom API and not sure how to handle dates. My API fetches the data from the database and returns them as ISO8601 text strings (yyyy-mm-dd – e.g. 2020-07-02). I have my report specified as below:
"caption":"My Reporting Date",
When I want to use the dates in Flexmonster I’m getting errors with both the flat and compact and classic display options. With the ‘flat’ option I see the grid but all of the dates show “Invalid date”. When I use the compact or classic option, the grid doesn’t display but I get an error message dialog “Error: Cannot read property ‘ordinal’ of null”.
I have tried various different approaches with various mapping types but I can’t seem to find the solution. I tried changing the mapping type to “date” and then it creates 3 separate fields – for “My Reporting Date.Day” as well as .Month & .Year – and I don’t have those fields obviously.
I just needs some advice on how I should be handling ISO8601 dates please.
Thank you for reaching out to us.
We would like to kindly explain that for the custom data source API, dates should be passed in the form of a Unix timestamp.
"2016-02-07" needs to be fed into Flexmonster as
"1454803200000". Then the dates should be recognized correctly and the
datePattern property can be applied.
Please let us know if this helps.
Looking forward to your reply.
Ah, OK, thank you very much, at least that explains my problem. I didn’t try that, although, as I have experience of Elasticsearch I maybe should have thought of that.
But I want you to know that this has given me a brainwave! I may be able to use Elasticsearch instead of creating my own API, this may make some things easier for me, but other a little more complex, but I thank you for giving me the idea.
And thank you for your excellent support.
Thank you for your feedback.
We are glad to hear that you found the explanation helpful.
Our team will review the corresponding documentation and see how it can be improved to make the integration process simpler.
As always, please feel free to reach out to us if further questions arise.