GoogleCloudPlatform/spanner-migration-tool

Timestamp parsing fails with iso8601 datetime format from CSV

michity15169 opened this issue · 0 comments

According to the manual, the Timestamp included in the CSV must be ISO 8601 compliant.
https://github.com/cloudspannerecosystem/harbourbridge/tree/master/sources/csv

- The only supported timestamp format right now is **ISO 8601**.

ISO 8601 states that dates and times are concatenated with a "T" as the delimiter.
https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations
However, the layout string currently used for parsing is as follows.

https://github.com/cloudspannerecosystem/harbourbridge/blob/master/sources/csv/data.go#L511

func convTimestamp(val string) (t time.Time, err error) {
        t, err = time.Parse("2006-01-02 15:04:05", val)

The current layout string does not match the representation of date and time combinations defined in ISO 8601.
I think the intersection of RFC3339 and ISO8601 is the most common layout
cf) https://ijmacd.github.io/rfc3339-iso8601/