Unable to Format FeatureTable Date

624
1
Jump to solution
01-19-2023 04:10 PM
dle13
by
New Contributor

I created a FeatureTable containing some points that I added to my map, but I am unable to change the format of the "date" field of type=date from the 13-digit Epoch time to MMDDYYYY or any other format. I've tried to use FeatureTable.dateOptions with no success.

dle13_0-1674173049005.png

This is the date field shown in the online Map Viewer that I used to create some points:

dle13_1-1674173287096.png

Snippet of my FeatureTable code:

const featureTable = new FeatureTable({
    view: view,
    layer: featureLayer,
    tableTemplate: {
        columnTemplates: [
            {
                type: "field",
                fieldName: "date",
                label: "DATE",
                direction: "asc"
            },
            {
                type: "field",
                fieldName: "title",
                label: "TITLE"
            },
            {
                type: "field",
                fieldName: "notes",
                label: "NOTES"
            },
            {
                type: "field",
                fieldName: "street",
                label: "ADDRESS"
            }
        ]
    },
    dateOptions: {
        timeEnabled: true,
        datePattern: "MM dd y"
    },
    container: "tableDiv"
});

Any help would be appreciated. Thank you!

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
dle13
by
New Contributor

I was able to solve my issue by performing the following steps:

  1. Go to ArcGIS Online
  2. Click on desired Layer
  3. Click on Data tab
  4. Click on Fields tab
  5. Select "date" Display Name
  6. Clear the date range, which was defined in Epoch/Unix time for some reason

No code changes were needed. After changing my settings to what is displayed below, I refreshed my FeatureTable to see that the date is now properly displayed in MM/DD/YYYY hh:mm format.

dle13_0-1674189942330.png

FeatureTable Date Column:

dle13_1-1674189980463.png

View solution in original post

0 Kudos
1 Reply
dle13
by
New Contributor

I was able to solve my issue by performing the following steps:

  1. Go to ArcGIS Online
  2. Click on desired Layer
  3. Click on Data tab
  4. Click on Fields tab
  5. Select "date" Display Name
  6. Clear the date range, which was defined in Epoch/Unix time for some reason

No code changes were needed. After changing my settings to what is displayed below, I refreshed my FeatureTable to see that the date is now properly displayed in MM/DD/YYYY hh:mm format.

dle13_0-1674189942330.png

FeatureTable Date Column:

dle13_1-1674189980463.png

0 Kudos