feat:#52 added new fetcher from new endpoint

This commit is contained in:
masterElmar
2023-11-30 00:00:38 +01:00
parent d887927645
commit 921a2c7a28
12 changed files with 610 additions and 63 deletions

View File

@@ -1,6 +1,10 @@
package date
import "time"
import (
"strconv"
"strings"
"time"
)
func GetDateFromWeekNumber(year int, weekNumber int, dayName string) (time.Time, error) {
// Create a time.Date for the first day of the year
@@ -46,3 +50,13 @@ func GetDateFromWeekNumber(year int, weekNumber int, dayName string) (time.Time,
return desiredDate, nil
}
// createEventFromTableData should create an event from the table data
// tableTime represents Hour and Minute like HH:MM
// tableDate returns a Time
func CreateTimeFromHourAndMinuteString(tableTime string) time.Time {
timeParts := strings.Split(tableTime, ":")
hour, _ := strconv.Atoi(timeParts[0])
minute, _ := strconv.Atoi(timeParts[1])
return time.Date(0, 0, 0, hour, minute, 0, 0, time.UTC)
}