From 71c49fa9848938422c9cdd4ca8b44e3131f862c4 Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 7 Dec 2023 16:30:14 +1300 Subject: [PATCH] time string --- migrations/20231128_jellyfish_migration/utils/utils.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/migrations/20231128_jellyfish_migration/utils/utils.go b/migrations/20231128_jellyfish_migration/utils/utils.go index c12e92c4c..0307379a7 100644 --- a/migrations/20231128_jellyfish_migration/utils/utils.go +++ b/migrations/20231128_jellyfish_migration/utils/utils.go @@ -40,6 +40,9 @@ func getValidatedTime(bsonData bson.M, fieldName string) (time.Time, error) { if valRaw, ok := bsonData[fieldName]; !ok { return time.Time{}, errors.Newf("%s is missing", fieldName) } else if val, ok := valRaw.(time.Time); !ok { + if tStr, ok := valRaw.(string); ok { + return time.Parse(time.RFC3339, tStr) + } return time.Time{}, errors.Newf("%s is not of expected type", fieldName) } else if val.IsZero() { return time.Time{}, errors.Newf("%s is empty", fieldName)