From 660e850a7267ab6893b13d4f121135670c578123 Mon Sep 17 00:00:00 2001 From: lanxu Date: Tue, 30 Nov 2021 00:25:26 +0200 Subject: [PATCH] Fixed pvm to show times with the correct locale --- plugins/pvm.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/pvm.js b/plugins/pvm.js index 16c90b8..3ba37f7 100644 --- a/plugins/pvm.js +++ b/plugins/pvm.js @@ -25,10 +25,7 @@ class Pwm extends BasePlugin { today () { var today = new Date() - var month = today.getMonth() + 1 - var day = today.getDate() - var dateString = day + '.' + month + '.' - return dateString + return (new Intl.DateTimeFormat('fi-FI', {day: 'numeric', month: 'numeric', timezone: 'Europe/Helsinki'}).format(today)) } getWeather (city, code) { var language = 'fi' @@ -78,8 +75,8 @@ class Pwm extends BasePlugin { let sunriseDate = new Date(Number(weather.sys.sunrise) * 1000) let sunsetDate = new Date(Number(weather.sys.sunset) * 1000) - let sunrise = sunriseDate.getHours() + '.' + sunriseDate.getMinutes() - let sunset = sunsetDate.getHours() + '.' + sunsetDate.getMinutes() + let sunrise = new Intl.DateTimeFormat('fi-FI', {hour: 'numeric', minute: 'numeric', timezone: 'Europe/Helsinki'}).format(sunriseDate) + let sunset = new Intl.DateTimeFormat('fi-FI', {hour: 'numeric', minute: 'numeric', timezone: 'Europe/Helsinki'}).format(sunsetDate) const $ = cheerio.load(data[0]) let names = []