Skip to content

Commit

Permalink
fix tasks 01 && 04
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasiiaxfr committed Dec 21, 2024
1 parent b3097bf commit 803d81a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
16 changes: 6 additions & 10 deletions 01-basics/20-weather/WeatherApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
},
Expand All @@ -34,7 +30,7 @@ export default defineComponent({
<ul class="weather-list unstyled-list">
<li class="weather-card" :class="{
'weather-card--night': isNightTime(region.current.dt, region.current.sunrise, region.current.sunset)
}" v-for="(region, index) in weatherData"
}" v-for="(region, index) in weatherData"
:key="index">
<div class="weather-alert" v-if="region.alert">
<span class="weather-alert__icon">⚠️</span>
Expand Down
2 changes: 1 addition & 1 deletion 04-sfc/10-MeetupView-script-setup/MeetupDescription.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defineProps({
</script>

<template>
<div class="meetup-description" v-html="description"></div>
<div class="meetup-description">{{ description }}</div>
</template>

<style scoped>
Expand Down

0 comments on commit 803d81a

Please sign in to comment.