From 803d81a160fcbae610a486efa1e483c58a66bb65 Mon Sep 17 00:00:00 2001 From: anastasiiaxfr Date: Sat, 21 Dec 2024 11:35:03 +0200 Subject: [PATCH] fix tasks 01 && 04 --- 01-basics/20-weather/WeatherApp.js | 16 ++++++---------- .../MeetupDescription.vue | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/01-basics/20-weather/WeatherApp.js b/01-basics/20-weather/WeatherApp.js index aa9e5c8..4dfb262 100644 --- a/01-basics/20-weather/WeatherApp.js +++ b/01-basics/20-weather/WeatherApp.js @@ -3,26 +3,22 @@ import { getWeatherData, WeatherConditionIcons } from './weather.service.ts' export default defineComponent({ name: 'WeatherApp', - + setup() { const weatherData = ref(getWeatherData()) - const kelvinToCelsius = (temp) => { - return (temp - 273.15).toFixed(1) + const kelvinToCelsius = temp => { + return (temp - 273.15).toFixed(1) } const isNightTime = (currentDt, sunrise, sunset) => { - const currentTime = new Date(`1970-01-01T${currentDt}:00`).getHours() - const sunriseHour = parseInt(sunrise.split(':')[0], 10) - const sunsetHour = parseInt(sunset.split(':')[0], 10) - - return currentTime < sunriseHour || currentTime >= sunsetHour + return currentDt < sunrise || currentDt >= sunset } return { weatherData, kelvinToCelsius, - WeatherConditionIcons, + WeatherConditionIcons, isNightTime, } }, @@ -34,7 +30,7 @@ export default defineComponent({