From 3e7a07dc2af86cc490e2dcfbb069871fae15eec6 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Sat, 28 Sep 2024 09:01:48 +0200 Subject: [PATCH] improve month sync again --- internal/service/booking/sync.go | 2 +- internal/view/layout/base.templ | 18 +++++++++--------- internal/view/layout/base_templ.go | 2 +- main.go | 9 +++++---- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/internal/service/booking/sync.go b/internal/service/booking/sync.go index f86a056..6f29cd3 100644 --- a/internal/service/booking/sync.go +++ b/internal/service/booking/sync.go @@ -86,7 +86,7 @@ func formatDate(date string) *time.Time { months := map[string]string{ "janv.": "01", "févr.": "02", "mar": "03", "avr": "04", "mai": "05", "juin": "06", "juil.": "07", "août": "08", - "sep": "09", "oct": "10", "nov": "11", "déc": "12", + "sep.": "09", "oct.": "10", "nov.": "11", "déc.": "12", } parts := strings.Split(date, " ") dateString := fmt.Sprintf("%s-%02s-%02s", parts[2], months[parts[1]], parts[0]) diff --git a/internal/view/layout/base.templ b/internal/view/layout/base.templ index 7a9b3c5..5e99078 100644 --- a/internal/view/layout/base.templ +++ b/internal/view/layout/base.templ @@ -13,15 +13,15 @@ templ BaseLayout() { + document.addEventListener("DOMContentLoaded", () => { + document.addEventListener("htmx:beforeSwap", (e) => { + if([422,401].includes(e.detail.xhr.status)) { + e.detail.shouldSwap = true + e.detail.isError = false + } + }) + }) +