Skip to content

Commit

Permalink
Merge pull request #210 from jakopako:jakopako/issue209
Browse files Browse the repository at this point in the history
auto date extraction sets date_location to CEST but this can't be parsed
  • Loading branch information
jakopako authored Apr 3, 2023
2 parents b7c73b2 + 1d823b8 commit 8b94ffc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
1 change: 1 addition & 0 deletions automate/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ outer:
// for now we assume that there will only be one date field
t := time.Now()
zone, _ := t.Zone()
zone = strings.Replace(zone, "CEST", "CET", 1) // quick hack for issue #209
dateField := scraper.Field{
Name: "date",
Type: "date",
Expand Down
13 changes: 1 addition & 12 deletions date/date.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,18 +255,7 @@ func getTimeFormatPart(index int, sepTokens []string, tokens []string) (string,
if index > 0 {
if sepTokens[index-1] == ":" || sepTokens[index-1] == "." {
// minute (could also be second but haven't encountered it so far. Adapt when necessary)
// if utils.OnlyContainsDigits(tokens[index]) {
return "04", nil
// }
// 7.30pm -> [7, 30pm] -> 30pm
// m := "04"
// for _, r := range tokens[index] {
// // not very generic, but works for now and can be adapted as soon as there are new cases
// if !unicode.IsDigit(r) {
// m += string(r)
// }
// }
// return m, nil
}
}
if len(tokens) > index+1 {
Expand All @@ -275,7 +264,7 @@ func getTimeFormatPart(index int, sepTokens []string, tokens []string) (string,
}
}
} else {
// one of 04h, 15u04, 15h04
// one of 04h, 15u04, 15h04, 04pm, 15pm
if strings.HasSuffix(tokens[index], "h") {
return "04h", nil
}
Expand Down

0 comments on commit 8b94ffc

Please sign in to comment.