Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions backend/core/models/common/iso8601time.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ func init() {
Matcher: regexp.MustCompile(`[+-][\d]{4}$`),
Format: "2006-01-02T15:04:05-0700",
},
{
Matcher: regexp.MustCompile(`[\d]{6}[+-][\d]{2}:[\d]{2}$`),
Format: "2006-01-02T15:04:05.000000-07:00",
},
{
Matcher: regexp.MustCompile(`[\d]{3}[+-][\d]{2}:[\d]{2}$`),
Format: "2006-01-02T15:04:05.000-07:00",
Expand Down
12 changes: 12 additions & 0 deletions backend/core/models/common/iso8601time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,18 @@ func TestConvertStringToTime(t *testing.T) {
output: time.Date(2023, 3, 1, 0, 0, 0, 0, time.UTC),
err: nil,
},
{
name: "Valid time string with milliseconds",
input: "2025-09-15T08:53:36.337+00:00",
output: time.Date(2025, 9, 15, 8, 53, 36, 337000000, time.UTC),
err: nil,
},
{
name: "Valid time string with microseconds (Bitbucket Cloud format)",
input: "2025-09-15T08:53:36.337932+00:00",
output: time.Date(2025, 9, 15, 8, 53, 36, 337932000, time.UTC),
err: nil,
},
{
name: "Invalid time string",
input: "invalid",
Expand Down
9 changes: 4 additions & 5 deletions backend/plugins/bitbucket/tasks/pr_extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package tasks

import (
"encoding/json"
"time"

"github.com/apache/incubator-devlake/core/errors"
"github.com/apache/incubator-devlake/core/models/common"
Expand Down Expand Up @@ -57,8 +56,8 @@ type BitbucketApiPullRequest struct {
} `json:"links"`
ClosedBy *BitbucketAccountResponse `json:"closed_by"`
Author *BitbucketAccountResponse `json:"author"`
BitbucketCreatedAt time.Time `json:"created_on"`
BitbucketUpdatedAt time.Time `json:"updated_on"`
BitbucketCreatedAt *common.Iso8601Time `json:"created_on"`
BitbucketUpdatedAt *common.Iso8601Time `json:"updated_on"`
BaseRef *struct {
Branch struct {
Name string `json:"name"`
Expand Down Expand Up @@ -174,8 +173,8 @@ func convertBitbucketPullRequest(pull *BitbucketApiPullRequest, connId uint64, r
Url: pull.Links.Html.Href,
Type: pull.Type,
CommentCount: pull.CommentCount,
BitbucketCreatedAt: pull.BitbucketCreatedAt,
BitbucketUpdatedAt: pull.BitbucketUpdatedAt,
BitbucketCreatedAt: pull.BitbucketCreatedAt.ToTime(),
BitbucketUpdatedAt: pull.BitbucketUpdatedAt.ToTime(),
}
if pull.BaseRef != nil {
if pull.BaseRef.Repo != nil {
Expand Down
Loading