Static option not working

Static option not working

gareththeredgareththered Posts: 2Questions: 1Answers: 0
edited March 9 in Free community support

Link to test case: https://live.datatables.net/liwonegi/1/edit?html,js,output
Debugger code (debug.datatables.net): (couldn't get it to work)
Error messages shown: No error as such, just incorrect rendering.
Description of problem: When I attempt to set the default rendering for dates as per https://datatables.net/examples/i18n/auto-render.html, it simply fails to render as a date. The original data is ISO 8601 and the output remains as ISO 8601. If I use column.render, it works fine.

I'm new to DataTables, so assume I'm doing something wrong. But I can't figure out what.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 64,230Questions: 1Answers: 10,599 Site admin
    Answer ✓

    DataTables doesn't have support for sub-second intervals built into to its ISO8601 formatting, which is what is tripping it up here. If I remove the .000000 from your example, that the date renders as expected: https://live.datatables.net/liwonegi/2/edit .

    If you can update the output format of your date to match that, then that's the way to do it.

    If you can't, you'll need to specify an exact format: https://datatables.net/examples/datetime/transform-moment.html .

    Allan

  • gareththeredgareththered Posts: 2Questions: 1Answers: 0

    Many thanks Allan. I'm glad it's such an easy fix. I'll tweak my source to remove the fractional seconds.

Sign In or Register to comment.