From: David ‘Bombe’ Roden Date: Wed, 1 Jun 2016 05:10:25 +0000 (+0200) Subject: Fix date parsing X-Git-Tag: v2~111 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=f157f4060e988f96711c20084d98db6885850622;p=rhynodge.git Fix date parsing --- diff --git a/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wetterde/WetterDeFilter.kt b/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wetterde/WetterDeFilter.kt index fc3f500..9df926f 100644 --- a/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wetterde/WetterDeFilter.kt +++ b/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wetterde/WetterDeFilter.kt @@ -26,7 +26,7 @@ import java.util.Locale class WetterDeFilter : Filter { object DateParser { - val parser = DateTimeFormatter.ofPattern("dd. MMM yyyy").withLocale(Locale.GERMAN).withZone(ZoneId.of("Europe/Berlin")) + val parser = DateTimeFormatter.ofPattern("dd. MMMM yyyy").withLocale(Locale.GERMAN).withZone(ZoneId.of("Europe/Berlin")) } override fun filter(state: State): State { diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/webpages/weather/wetterde/WetterDeFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/webpages/weather/wetterde/WetterDeFilterTest.kt index fa79869..f251cf8 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/webpages/weather/wetterde/WetterDeFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/webpages/weather/wetterde/WetterDeFilterTest.kt @@ -45,7 +45,7 @@ class WetterDeFilterTest { fun filterCanParseDateCorrectly() { val htmlState = HtmlState(url, ResourceLoader.loadDocument(javaClass, "wetter.de.html", url)) val wetterDeState = filter.filter(htmlState) as WeatherState - assertThat(wetterDeState.dateTime, `is`(ZonedDateTime.of(2016, 5, 30, 0, 0, 0, 0, ZoneId.of("Europe/Berlin")))) + assertThat(wetterDeState.dateTime, `is`(ZonedDateTime.of(2016, 6, 1, 0, 0, 0, 0, ZoneId.of("Europe/Berlin")))) } @Test diff --git a/src/test/resources/net/pterodactylus/rhynodge/webpages/weather/wetterde/wetter.de.html b/src/test/resources/net/pterodactylus/rhynodge/webpages/weather/wetterde/wetter.de.html index 8fb8021..63452e3 100644 --- a/src/test/resources/net/pterodactylus/rhynodge/webpages/weather/wetterde/wetter.de.html +++ b/src/test/resources/net/pterodactylus/rhynodge/webpages/weather/wetterde/wetter.de.html @@ -1518,7 +1518,7 @@ document.write(' -
Montag, den 30. Mai 2016
+
Mittwoch, den 01. Juni 2016