I'm rendering JSON dates that look like this: /Date(1185336000000)/
and I'm trying to convert them to a ("mmmm d, yyyy")
-type format.
I tried a if...includes()
and then a format()
method, but they didn't work (bad syntax) and they disabled already rendered data.
JS snippet:
import firmData from '../JSON/firmDir.json';
function loadBio() {
let dateOfHire = firmData.d.results.map(function(val) {
// if (val.hiredate === null || undefined) return " ";
let newDate = val.hiredate;
if (newDate.includes('000')) {
newDate.format("mmmm d, yyyy");
}
return val.hiredate
})
$("#hireDate-id").append(dateOfHire);
}
loadBio()
JSON snippet:
{
"d": {
"results": [
{
"hiredate": "/Date(1185336000000)/",
...