INNER CODE UNIT · Go
DateStringToJiraFormatInLocation
ankitpokhrel/jira-cli · internal/cmdutil/datetime.go:30
func DateStringToJiraFormatInLocation(value string, timezone string) (string, error) {
if value == "" || value == "0" || value == "0000-00-00 00:00:00" || value == "0000-00-00" || value == "00:00:00" {
return "", nil
}
if _, err := time.Parse(jira.RFC3339MilliLayout, value); err == nil {
return value, nil
}
layout := DateTimeLayout
if _, err := strconv.ParseInt(value, 10, 64); err == nil {
switch {
case len(value) == 8:
layout = ShortDateLayout
case len(value) == 14:
layout = ShortDateTimeLayout
}
} else if len(value) == 10 && strings.Count(value, "-") == 2 {