This is an automated email from the ASF dual-hosted git repository.

warren pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new c24a34ac [Improvement][DateTimeFormatItem]Add a date time format
c24a34ac is described below

commit c24a34ace86169056dd71bf08c9db649accdc7e0
Author: Mr.An <[email protected]>
AuthorDate: Fri Jun 10 03:52:17 2022 +0800

    [Improvement][DateTimeFormatItem]Add a date time format
---
 plugins/helper/iso8601time.go      | 6 +++++-
 plugins/helper/iso8601time_test.go | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/plugins/helper/iso8601time.go b/plugins/helper/iso8601time.go
index f5628ceb..7da6372d 100644
--- a/plugins/helper/iso8601time.go
+++ b/plugins/helper/iso8601time.go
@@ -57,9 +57,13 @@ func init() {
                        Format:  "2006-01-02T15:04:05-0700",
                },
                {
-                       Matcher: regexp.MustCompile(`[+-][\d]{2}:[\d]{2}$`),
+                       Matcher: 
regexp.MustCompile(`[\d]{3}[+-][\d]{2}:[\d]{2}$`),
                        Format:  "2006-01-02T15:04:05.000-07:00",
                },
+               {
+                       Matcher: regexp.MustCompile(`[+-][\d]{2}:[\d]{2}$`),
+                       Format:  "2006-01-02T15:04:05-07:00",
+               },
        }
 }
 
diff --git a/plugins/helper/iso8601time_test.go 
b/plugins/helper/iso8601time_test.go
index 247ff94e..fa7fdcb5 100644
--- a/plugins/helper/iso8601time_test.go
+++ b/plugins/helper/iso8601time_test.go
@@ -52,6 +52,7 @@ func TestIso8601Time(t *testing.T) {
                `{ "Created": "2021-07-30T19:14:33+0100" }`:      
TimeMustParse("2021-07-30T18:14:33Z"),
                `{ "Created": "2021-07-30T19:14:33.000-01:00" }`: 
TimeMustParse("2021-07-30T20:14:33Z"),
                `{ "Created": "2021-07-30T19:14:33.000+01:00" }`: 
TimeMustParse("2021-07-30T18:14:33Z"),
+               `{ "Created": "2021-07-30T19:14:33+01:00" }`:     
TimeMustParse("2021-07-30T18:14:33Z"),
        }
 
        for input, expected := range pairs {

Reply via email to