Hey ND,
Thanks for the try…my date format is: “Month/Day/Year”…your code is not prepared for that data and probably is why it’s getting the error…
I did find the issue…below are 2 sets of data …
-
dataset has date where can be single digit day or month and that is what’s making it not work with the format “%m/%/d%Y”
-
dataset_02 does work with the format “%m/%/d%Y”
So I can manipulate the date on the backend before processed by javascript or is there a format that will work with a date that can have a single digit day or month?
Thanks!
<script>
const dataset =
[
{"first_discovered":"4/13/2022","last_discovered":"4/13/2022"},
{"first_discovered":"7/13/2020","last_discovered":"4/13/2022"},
{"first_discovered":"4/13/2022","last_discovered":"4/13/2022"},
{"first_discovered":"6/25/2021","last_discovered":"4/13/2022"},
{"first_discovered":"3/30/2022","last_discovered":"4/13/2022"},
{"first_discovered":"2/13/2018","last_discovered":"4/13/2022"}
]
const dataset_02 =
[
{"first_discovered":"04/13/2022","last_discovered":"04/13/2022"},
{"first_discovered":"07/13/2020","last_discovered":"04/13/2022"},
{"first_discovered":"04/13/2022","last_discovered":"04/13/2022"},
{"first_discovered":"06/25/2021","last_discovered":"04/13/2022"},
{"first_discovered":"03/30/2022","last_discovered":"04/13/2022"},
{"first_discovered":"02/13/2018","last_discovered":"04/13/2022"}
]
const grid = new dhx.Grid("grid", {
columns: [
{ width: 150, id: "first_discovered", header: [{ text: "First Discovered" }, { content: "inputFilter" }],type: "date", format: "%m/%d/%Y" },
{ width: 150, id: "last_discovered", header: [{ text: "Last Discovered" },{ content: "inputFilter" }],type: "date", format: "%m/%d/%Y" }
],
data: dataset_02
});
</script>