Skip to content

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

@candiduslynx

Description

@candiduslynx

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions