diff --git a/01-basics/10-create-app/script.js b/01-basics/10-create-app/script.js
index 40fac68..66453bc 100644
--- a/01-basics/10-create-app/script.js
+++ b/01-basics/10-create-app/script.js
@@ -1 +1,18 @@
import { defineComponent, createApp } from 'vue'
+
+const App = defineComponent({
+ name: 'App',
+
+ setup() {
+ const getDateLocal = new Date().toLocaleDateString(navigator.language, { dateStyle: 'long' });
+
+ return {
+ getDateLocal
+ }
+ },
+
+ template: `
Сегодня {{ getDateLocal }}
`
+});
+
+const app = createApp(App);
+app.mount('#app');
diff --git a/01-basics/20-weather/WeatherApp.js b/01-basics/20-weather/WeatherApp.js
index 54dbfd6..d82a0d9 100644
--- a/01-basics/20-weather/WeatherApp.js
+++ b/01-basics/20-weather/WeatherApp.js
@@ -1,51 +1,91 @@
-import { defineComponent } from 'vue'
-import { getWeatherData, WeatherConditionIcons } from './weather.service.ts'
+import {defineComponent} from 'vue'
+import {getWeatherData, WeatherConditionIcons} from './weather.service.ts'
+
+function getIconByConditionId(id) {
+ return WeatherConditionIcons[parseInt(id)] || '';
+}
+
+function timeToSeconds(time) {
+ return time.split(':')[0]*60 + time.split(':')[1]*1;
+}
+
+function isDayNow(currientTime, sunriseTime, sunsetTime) {
+ return timeToSeconds(sunriseTime) < timeToSeconds(currientTime) && timeToSeconds(currientTime) < timeToSeconds(sunsetTime);
+}
+
+function kelvinToCelsius(tempK) {
+ return (tempK - 273.15).toFixed(1);
+}
+
+function pressureConvert(pressure) {
+ return Math.round(pressure * 0.75 );
+}
export default defineComponent({
- name: 'WeatherApp',
-
- template: `
-
-
Погода в Средиземье
-
-
-
- `,
+ name: 'WeatherApp',
+
+ setup() {
+ const weatherData = getWeatherData();
+
+ return {
+ weatherData,
+ isDayNow,
+ getIconByConditionId,
+ kelvinToCelsius,
+ pressureConvert
+ }
+ },
+
+ template: `
+
+
Погода в Средиземье
+
+
+
+ `,
})