fixed timezone in database

This commit is contained in:
Elmar Kresse
2023-09-21 18:38:40 +02:00
parent 61b20e46dd
commit 355b850ac5

View File

@@ -117,12 +117,13 @@ func convertWeeksToDates(events []model.Event, semester string, year string) []m
} }
func addTimeToDate(date time.Time, timeString string) time.Time { func addTimeToDate(date time.Time, timeString string) time.Time {
europeTime, _ := time.LoadLocation("Europe/Berlin")
//convert time string to time //convert time string to time
timeParts := strings.Split(timeString, ":") timeParts := strings.Split(timeString, ":")
hour, _ := strconv.Atoi(timeParts[0]) hour, _ := strconv.Atoi(timeParts[0])
minute, _ := strconv.Atoi(timeParts[1]) minute, _ := strconv.Atoi(timeParts[1])
return time.Date(date.Year(), date.Month(), date.Day(), hour, minute, 0, 0, time.UTC) return time.Date(date.Year(), date.Month(), date.Day(), hour, minute, 0, 0, europeTime)
} }
func extractSemesterAndYear(semesterString string) (string, string) { func extractSemesterAndYear(semesterString string) (string, string) {