cloudquery/plugin-sdk

`time.Time` values don't get converted to `UTC` zone

Closed this issue · 0 comments

Describe the bug

When API returns a field in time.Time, *time.Time or a convertible format (e.g., *timestamppb.Timestamp), plugin-sdk doesn't move this data to UTC timezone.
However, several destination plugins rely on this (e.g., PostgreSQL that uses timestamp without time zone column type) to be true.

Expected Behavior

All time values should be moved to UTC timezone.

Steps to Reproduce

Sync from a timezone that differs from UTC.

Possible Solution

When doing Set for time we need to make sure we do a sanitize there.

func (dst *Timestamptz) sanitize() *Timestamptz {
  if dst.Status == Present {
    dst.Time = dst.Time.UTC()
  }
  return dst
}

Provider and CloudQuery version

latest

Additional Context

No response