Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Pattern;
Expand All @@ -31,36 +30,27 @@

public class IssueBean {

@JsonIgnore
private final Pattern JiraDateTimePattern = Pattern.compile(
"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}[-+]\\d{4}$");
@JsonIgnore
private final DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ");

/**
* Expand options that include additional issue details in the response.
*/
@Getter
@Setter
@JsonProperty("expand")
private String expand = null;

/**
* The ID of the issue.
*/
@Getter
@Setter
@JsonProperty("id")
private String id = null;

/**
* The URL of the issue details.
*/
@Getter
@Setter
@JsonProperty("self")
private String self = null;

/**
* The key of the issue.
*/
Expand Down Expand Up @@ -88,7 +78,12 @@ public class IssueBean {
@Setter
@JsonProperty("fields")
private Map<String, Object> fields = null;


@JsonIgnore
private final Pattern JiraDateTimePattern = Pattern.compile(
"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}[-+]\\d{4}$");
@JsonIgnore
private final DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ");

@JsonIgnore
public String getProject() {
Expand Down Expand Up @@ -124,8 +119,7 @@ private long getGivenDateField(String dateTimeFieldToPull) {
.toString()).matches()) {
String charSequence = fields.get(dateTimeFieldToPull).toString();
OffsetDateTime offsetDateTime = OffsetDateTime.parse(charSequence, offsetDateTimeFormatter);
new Date(offsetDateTime.toInstant().toEpochMilli());
dateTimeField = offsetDateTime.toEpochSecond() * 1000;
dateTimeField = offsetDateTime.toInstant().toEpochMilli();
}
return dateTimeField;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ void testGivenDateField() {
fieldsTestObject.put("created", "2024-07-06T21:12:23.437-0700");
fieldsTestObject.put("updated", "2022-07-06T21:12:23.106-0700");
issueBean.setFields(fieldsTestObject);
assertEquals(issueBean.getCreatedTimeMillis(), 1720325543000L);
assertEquals(issueBean.getUpdatedTimeMillis(), 1657167143000L);
assertEquals(1720325543437L, issueBean.getCreatedTimeMillis());
assertEquals(1657167143106L, issueBean.getUpdatedTimeMillis());
}

@Test
Expand Down