Skip to content

Commit 1f6f813

Browse files
committed
oval: add additional date format as seen in the wild
This adds support for a particularly annoying format that doesn't even specify a single date. Signed-off-by: Hank Donnay <[email protected]>
1 parent 08a0863 commit 1f6f813

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

oval/types.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,13 @@ func (d *Date) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error {
144144
var err error
145145
// Try a variety of formats, because everything is terrible.
146146
for _, f := range []string{
147-
"2006-01-02", // Debian-style YYYY-MM-DD
148-
"2006-01-02 15:04:05 MST", // Ubuntu style YYYY-MM-DD time zone
147+
"2006-01-02", // Debian style `YYYY-MM-DD`
148+
"2006-01-02 15:04:05 MST", // Ubuntu style `YYYY-MM-DD time zone`
149149
time.RFC1123, // The rest of these seem like someone might use them.
150150
time.RFC1123Z,
151151
time.RFC3339,
152152
time.RFC3339Nano,
153+
"2006-01-02 15:04:05", // Ubuntu style `YYYY-MM-DD time`, for when you want to seem precise.
153154
} {
154155
d.Date, err = time.Parse(f, s)
155156
if err == nil {

0 commit comments

Comments
 (0)