diff --git a/lib/debezium/converters/time.go b/lib/debezium/converters/time.go index 6aef63bd6..cf236a796 100644 --- a/lib/debezium/converters/time.go +++ b/lib/debezium/converters/time.go @@ -35,6 +35,12 @@ func ConvertDateTimeWithTimezone(value any) (*ext.ExtendedTime, error) { return nil, fmt.Errorf("failed to parse %q, err: %w", dtString, err) } +var SupportedTimeWithTimezoneFormats = []string{ + "15:04:05Z", // w/o fractional seconds + "15:04:05.000Z", // ms + "15:04:05.000000Z", // microseconds +} + func ConvertTimeWithTimezone(value any) (*ext.ExtendedTime, error) { valString, isOk := value.(string) if !isOk { @@ -43,7 +49,7 @@ func ConvertTimeWithTimezone(value any) (*ext.ExtendedTime, error) { var err error var ts time.Time - for _, supportedTimeFormat := range ext.SupportedTimeWithTimezoneFormats { + for _, supportedTimeFormat := range SupportedTimeWithTimezoneFormats { ts, err = ext.ParseTimeExactMatch(supportedTimeFormat, valString) if err == nil { return ext.NewExtendedTime(ts, ext.TimeKindType, supportedTimeFormat), nil diff --git a/lib/typing/ext/variables.go b/lib/typing/ext/variables.go index 2814d4117..0b82bb368 100644 --- a/lib/typing/ext/variables.go +++ b/lib/typing/ext/variables.go @@ -36,12 +36,6 @@ var SupportedTimeFormatsLegacy = []string{ AdditionalTimeFormat, } -var SupportedTimeWithTimezoneFormats = []string{ - "15:04:05Z", // w/o fractional seconds - "15:04:05.000Z", // ms - "15:04:05.000000Z", // microseconds -} - func NewUTCTime(layout string) string { return time.Now().UTC().Format(layout) }