Set custom display processor from plugin

Hi all,

I develop a datasource plugin and have a specific time formatting criteria. Available out of the box units don’t fit all criteria. There are 2 possible solutions:

What do you think about that? Is there any other ways to solve my problem?
I’m happy to contribute a fix if we agree on the solution.

Thank you in advance!
Dima

Datasources are free to modify any of the data they return at will, so you can format dates in the datasource if you want, but, it is always best to let the visualization part handle the formatting of dates and have your datasource return a standard format (usually a unix timestamp or iso) so I advice against it.

One thing the user can do is apply a transformation such as the convert field type which allows you to take a field, turn it into a time field (even if already was one) and format it to any custom format you’d want using moment js which will support any possible Gregorian calendar format you want.

I strongly advice you to follow this idea, but if you really want to have it on your datasource, you can create a custom option in your query editor where the user can check a box, or select from a dropdown the format they want for their time and have the datasource modify the dates accordingly.

1 Like

it is always best to let the visualization part handle the formatting of dates and have your datasource return a standard format

I completely agree with that. However, formatting date/duration on the transformation level leads to the same problem as on the datasource level (e.g. breaks sorting by the column). That’s why I’m asking for possibility to do it on the visualization level.