From 1cfd797db9f9bdd17e4e721c74857bc3c0479e8c Mon Sep 17 00:00:00 2001 From: Anastasia th9 Date: Tue, 17 Dec 2024 12:19:11 +0200 Subject: [PATCH] answer: task 2 --- 01-basics/10-create-app/script.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/01-basics/10-create-app/script.js b/01-basics/10-create-app/script.js index 40fac68..d48bc29 100644 --- a/01-basics/10-create-app/script.js +++ b/01-basics/10-create-app/script.js @@ -1 +1,21 @@ import { defineComponent, createApp } from 'vue' + +const Comp = defineComponent({ + name: 'CurrentDate', + setup() { + function formatAsLocalDate(date) { + return new Date(date).toLocaleDateString(undefined, { dateStyle: 'long' }); + } + + const currentDate = new Date(); + + return { + formatAsLocalDate, + currentDate + }; + }, + template: `
Сегодня {{ formatAsLocalDate(currentDate) }}
` +}); + + +createApp(Comp).mount("#app"); \ No newline at end of file