domoritz opened a new pull request, #40892:
URL: https://github.com/apache/arrow/pull/40892
Tested with
```ts
const date = new Date("2023-03-29T12:34:56Z");
console.log("original", date)
console.log("=> vec")
const vec = arrow.vectorFromArray([date])
console.log(vec.toArray())
console.log(vec.toJSON())
console.log(vec.type)
console.log(vec.get(0))
console.log("=> vec2")
const vec2 = arrow.vectorFromArray([date], new arrow.DateMillisecond)
console.log(vec2.toArray())
console.log(vec.toJSON())
console.log(vec2.type)
console.log(vec2.get(0))
console.log("=> table")
const table = arrow.tableFromJSON([{ date }])
console.log(table.toArray())
console.log(table.schema.fields[0].type)
console.log(table.getChildAt(0)?.get(0))
console.log("=> table2")
const table2 = arrow.tableFromIPC(arrow.tableToIPC(table));
console.log(table2.toArray())
console.log(table2.schema.fields[0].type)
console.log(table2.getChildAt(0)?.get(0))
console.log("=> table3")
const table3 = new arrow.Table({ dates: vec2 })
console.log(table3.toArray())
console.log(table3.schema.fields[0].type)
console.log(table3.getChildAt(0)?.get(0))
```
```
=> table
[
{"date": Wed Mar 29 2023 08:34:56 GMT-0400 (Eastern Daylight Time)}
]
TimestampMillisecond {
typeId: 10,
unit: 1,
timezone: undefined,
toString: [Function: toString],
ArrayType: [class Int32Array],
[Symbol(Symbol.toStringTag)]: "Timestamp",
children: null,
OffsetArrayType: [class Int32Array],
}
2023-03-29T12:34:56.000Z
=> table2
[
{"date": Wed Mar 29 2023 08:34:56 GMT-0400 (Eastern Daylight Time)}
]
Timestamp_ {
typeId: 10,
unit: 1,
timezone: null,
toString: [Function: toString],
ArrayType: [class Int32Array],
children: null,
OffsetArrayType: [class Int32Array],
}
2023-03-29T12:34:56.000Z
=> table3
[
{"dates": Wed Mar 29 2023 08:34:56 GMT-0400 (Eastern Daylight Time)}
]
DateMillisecond {
typeId: 8,
unit: 1,
toString: [Function: toString],
ArrayType: [class Int32Array],
[Symbol(Symbol.toStringTag)]: "Date",
children: null,
OffsetArrayType: [class Int32Array],
}
2023-03-29T12:34:56.000Z
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]