Fixed pvm to show times with the correct locale

This commit is contained in:
lanxu 2021-11-30 00:25:26 +02:00
parent e0ced417fb
commit 660e850a72

View File

@ -25,10 +25,7 @@ class Pwm extends BasePlugin {
today () { today () {
var today = new Date() var today = new Date()
var month = today.getMonth() + 1 return (new Intl.DateTimeFormat('fi-FI', {day: 'numeric', month: 'numeric', timezone: 'Europe/Helsinki'}).format(today))
var day = today.getDate()
var dateString = day + '.' + month + '.'
return dateString
} }
getWeather (city, code) { getWeather (city, code) {
var language = 'fi' var language = 'fi'
@ -78,8 +75,8 @@ class Pwm extends BasePlugin {
let sunriseDate = new Date(Number(weather.sys.sunrise) * 1000) let sunriseDate = new Date(Number(weather.sys.sunrise) * 1000)
let sunsetDate = new Date(Number(weather.sys.sunset) * 1000) let sunsetDate = new Date(Number(weather.sys.sunset) * 1000)
let sunrise = sunriseDate.getHours() + '.' + sunriseDate.getMinutes() let sunrise = new Intl.DateTimeFormat('fi-FI', {hour: 'numeric', minute: 'numeric', timezone: 'Europe/Helsinki'}).format(sunriseDate)
let sunset = sunsetDate.getHours() + '.' + sunsetDate.getMinutes() let sunset = new Intl.DateTimeFormat('fi-FI', {hour: 'numeric', minute: 'numeric', timezone: 'Europe/Helsinki'}).format(sunsetDate)
const $ = cheerio.load(data[0]) const $ = cheerio.load(data[0])
let names = [] let names = []