25 lines
460 B
Go
25 lines
460 B
Go
package spc
|
|
|
|
import (
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
// ParseISOTimestamp parses SPC ISO timestamps from GeoJSON properties.
|
|
func ParseISOTimestamp(value string) (time.Time, error) {
|
|
return time.Parse(time.RFC3339, strings.TrimSpace(value))
|
|
}
|
|
|
|
func parseOptionalISOTimestamp(value string) *time.Time {
|
|
value = strings.TrimSpace(value)
|
|
if value == "" {
|
|
return nil
|
|
}
|
|
t, err := ParseISOTimestamp(value)
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
tt := t.UTC()
|
|
return &tt
|
|
}
|