fix date regex

This commit is contained in:
Ruidy 2024-06-20 18:39:26 +02:00
parent ba950f3b03
commit 82773aab3b
No known key found for this signature in database
GPG key ID: E00F51288CB857CC

View file

@ -3,6 +3,7 @@ package booking
import (
"encoding/json"
"fmt"
"log"
"regexp"
"strconv"
"strings"
@ -258,11 +259,11 @@ func (bs Service) ParseFromApi(rawContent string) (*Booking, error) {
}
func extractDate(pattern, content string) string {
re := regexp.MustCompile(pattern + `\w+\.\s*\d{1,2}\s\w+\.\s\d{4}`)
re := regexp.MustCompile(pattern + `\w+\.\s*\d{1,2}\s\w+\.*\s\d{4}`)
dateMatch := re.FindString(content)
if dateMatch == "" {
fmt.Println("date not found")
log.Println("date not found")
return ""
}