(client, resource, column)
| 127 | case APIFieldType.createdTime: |
| 128 | case APIFieldType.lastModifiedTime: { |
| 129 | const resolver: ColumnResolver = (client, resource, column) => { |
| 130 | const data = getProperty(resource.getItem(), field.name); |
| 131 | if (!data) { |
| 132 | return Promise.resolve(resource.setColumData(column.name, null)); |
| 133 | } |
| 134 | |
| 135 | const dateFormat = normalizeDateFormat(field.options.result.options.dateFormat.format); |
| 136 | if (field.options.result.type === 'date') { |
| 137 | const formatted = dayjs(data as string, dateFormat).toDate(); |
| 138 | return Promise.resolve(resource.setColumData(column.name, formatted)); |
| 139 | } |
| 140 | |
| 141 | const timeFormat = field.options.result.options.timeFormat.format; |
| 142 | const format = `${dateFormat} ${timeFormat}`; |
| 143 | const timezone = normalizeTimeZone(field.options.result.options.timeZone); |
| 144 | const formatted = dayjs.tz(data as string, format, timezone).toDate(); |
| 145 | return Promise.resolve(resource.setColumData(column.name, formatted)); |
| 146 | }; |
| 147 | return resolver; |
| 148 | } |
| 149 | case APIFieldType.date: { |
nothing calls this directly
no test coverage detected