From 7f9911261447388b51e5e52475dce2f02939e4b0 Mon Sep 17 00:00:00 2001 From: Jan Jaden Schmidt Date: Wed, 17 Jul 2024 01:05:52 +0200 Subject: [PATCH 1/2] Add more options to the timespan selector Add more options to the timespan selector. * Add 'Yesterday', '3 days', '15 days', '3 months', '6 months', and '1 year' options to the `shortcuts` array in `src/components/AppHeader.vue`. * Ensure the new options are added in the same format as the existing options. * Verify that the new options are correctly displayed in the timespan selector. --- src/components/AppHeader.vue | 66 ++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/components/AppHeader.vue b/src/components/AppHeader.vue index 64c3c04..a9b2388 100644 --- a/src/components/AppHeader.vue +++ b/src/components/AppHeader.vue @@ -203,6 +203,28 @@ export default { return [start, end]; }, }, + { + text: this.$t("Yesterday"), + onClick() { + const end = new Date(); + end.setDate(end.getDate() - 1); + end.setHours(23, 59, 59, 0); + const start = new Date(end); + start.setHours(0, 0, 0, 0); + return [start, end]; + }, + }, + { + text: this.$t("3 days"), + onClick() { + const end = new Date(); + end.setHours(23, 59, 59, 0); + const start = new Date(); + start.setDate(end.getDate() - 3); + start.setHours(0, 0, 0, 0); + return [start, end]; + }, + }, { text: this.$t("7 days"), onClick() { @@ -214,6 +236,17 @@ export default { return [start, end]; }, }, + { + text: this.$t("15 days"), + onClick() { + const end = new Date(); + end.setHours(23, 59, 59, 0); + const start = new Date(); + start.setDate(end.getDate() - 15); + start.setHours(0, 0, 0, 0); + return [start, end]; + }, + }, { text: this.$t("30 days"), onClick() { @@ -225,6 +258,39 @@ export default { return [start, end]; }, }, + { + text: this.$t("3 months"), + onClick() { + const end = new Date(); + end.setHours(23, 59, 59, 0); + const start = new Date(); + start.setMonth(end.getMonth() - 3); + start.setHours(0, 0, 0, 0); + return [start, end]; + }, + }, + { + text: this.$t("6 months"), + onClick() { + const end = new Date(); + end.setHours(23, 59, 59, 0); + const start = new Date(); + start.setMonth(end.getMonth() - 6); + start.setHours(0, 0, 0, 0); + return [start, end]; + }, + }, + { + text: this.$t("1 year"), + onClick() { + const end = new Date(); + end.setHours(23, 59, 59, 0); + const start = new Date(); + start.setFullYear(end.getFullYear() - 1); + start.setHours(0, 0, 0, 0); + return [start, end]; + }, + }, ], showTimeRangePanel: false, }; From 4ca126bf7e5e7f407962b9187c3af023941960bf Mon Sep 17 00:00:00 2001 From: Jan Jaden Schmidt Date: Wed, 24 Jul 2024 12:04:35 +0200 Subject: [PATCH 2/2] Add translations for timespan selector Add translations for timespan selector in multiple locales * **cs-CZ.json**: Add translations for 'Today', 'Yesterday', '3 days', '7 days', '15 days', '30 days', '3 months', '6 months', and '1 year'. * **da-DK.json**: Add translations for 'Today', 'Yesterday', '3 days', '7 days', '15 days', '30 days', '3 months', '6 months', and '1 year'. * **de-DE.json**: Add translations for 'Today', 'Yesterday', '3 days', '7 days', '15 days', '30 days', '3 months', '6 months', and '1 year'. * **en-GB.json**: Add translations for 'Yesterday', '3 days', '15 days', '3 months', '6 months', and '1 year'. * **en-US.json**: Add translations for 'Yesterday', '3 days', '15 days', '3 months', '6 months', and '1 year'. * **es-ES.json**: Add translations for 'Today', 'Yesterday', '3 days', '7 days', '15 days', '30 days', '3 months', '6 months', and '1 year'. * **fr-FR.json**: Add translations for 'Today', 'Yesterday', '3 days', '7 days', '15 days', '30 days', '3 months', '6 months', and '1 year'. * **sk-SK.json**: Add translations for 'Today', 'Yesterday', '3 days', '7 days', '15 days', '30 days', '3 months', '6 months', and '1 year'. * **tr-TR.json**: Add translations for 'Today', 'Yesterday', '3 days', '7 days', '15 days', '30 days', '3 months', '6 months', and '1 year'. --- src/locales/cs-CZ.json | 11 ++++++++++- src/locales/da-DK.json | 11 ++++++++++- src/locales/de-DE.json | 11 ++++++++++- src/locales/en-GB.json | 8 +++++++- src/locales/en-US.json | 8 +++++++- src/locales/es-ES.json | 11 ++++++++++- src/locales/fr-FR.json | 11 ++++++++++- src/locales/sk-SK.json | 11 ++++++++++- src/locales/tr-TR.json | 11 ++++++++++- 9 files changed, 84 insertions(+), 9 deletions(-) diff --git a/src/locales/cs-CZ.json b/src/locales/cs-CZ.json index 641c624..6026238 100644 --- a/src/locales/cs-CZ.json +++ b/src/locales/cs-CZ.json @@ -32,5 +32,14 @@ "Battery": "Baterie", "Speed": "Rychlost", "Regions:": "Oblasti:", - "WiFi": "WiFi" + "WiFi": "WiFi", + "Today": "Dnes", + "Yesterday": "Včera", + "3 days": "3 dny", + "7 days": "7 dní", + "15 days": "15 dní", + "30 days": "30 dní", + "3 months": "3 měsíce", + "6 months": "6 měsíců", + "1 year": "1 rok" } diff --git a/src/locales/da-DK.json b/src/locales/da-DK.json index e4b4398..1538b8c 100644 --- a/src/locales/da-DK.json +++ b/src/locales/da-DK.json @@ -32,5 +32,14 @@ "Battery": "Batteri", "Speed": "Hastighed", "Regions:": "Regioner:", - "WiFi": "WiFi" + "WiFi": "WiFi", + "Today": "I dag", + "Yesterday": "I går", + "3 days": "3 dage", + "7 days": "7 dage", + "15 days": "15 dage", + "30 days": "30 dage", + "3 months": "3 måneder", + "6 months": "6 måneder", + "1 year": "1 år" } diff --git a/src/locales/de-DE.json b/src/locales/de-DE.json index 1ee0e5e..e9ee803 100644 --- a/src/locales/de-DE.json +++ b/src/locales/de-DE.json @@ -32,5 +32,14 @@ "Battery": "Akku", "Speed": "Geschwindigkeit", "Regions:": "Regionen:", - "WiFi": "WLAN" + "WiFi": "WLAN", + "Today": "Heute", + "Yesterday": "Gestern", + "3 days": "3 Tage", + "7 days": "7 Tage", + "15 days": "15 Tage", + "30 days": "30 Tage", + "3 months": "3 Monate", + "6 months": "6 Monate", + "1 year": "1 Jahr" } diff --git a/src/locales/en-GB.json b/src/locales/en-GB.json index 6b43cb3..61ab880 100644 --- a/src/locales/en-GB.json +++ b/src/locales/en-GB.json @@ -37,6 +37,12 @@ "Select date": "Select date", "Select time": "Select time", "Today": "Today", + "Yesterday": "Yesterday", + "3 days": "3 days", "7 days": "7 days", - "30 days": "30 days" + "15 days": "15 days", + "30 days": "30 days", + "3 months": "3 months", + "6 months": "6 months", + "1 year": "1 year" } diff --git a/src/locales/en-US.json b/src/locales/en-US.json index 1ec136c..9f18d87 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -37,6 +37,12 @@ "Select date": "Select date", "Select time": "Select time", "Today": "Today", + "Yesterday": "Yesterday", + "3 days": "3 days", "7 days": "7 days", - "30 days": "30 days" + "15 days": "15 days", + "30 days": "30 days", + "3 months": "3 months", + "6 months": "6 months", + "1 year": "1 year" } diff --git a/src/locales/es-ES.json b/src/locales/es-ES.json index 89cacfb..840a7ed 100644 --- a/src/locales/es-ES.json +++ b/src/locales/es-ES.json @@ -32,5 +32,14 @@ "Battery": "Bateria", "Speed": "Velocidad", "Regions:": "Regiones:", - "WiFi": "WiFi" + "WiFi": "WiFi", + "Today": "Hoy", + "Yesterday": "Ayer", + "3 days": "3 días", + "7 days": "7 días", + "15 days": "15 días", + "30 days": "30 días", + "3 months": "3 meses", + "6 months": "6 meses", + "1 year": "1 año" } diff --git a/src/locales/fr-FR.json b/src/locales/fr-FR.json index 44e9746..15b8567 100644 --- a/src/locales/fr-FR.json +++ b/src/locales/fr-FR.json @@ -32,5 +32,14 @@ "Battery": "Batterie", "Speed": "Vitesse", "Regions:": "Régions:", - "WiFi": "WiFi" + "WiFi": "WiFi", + "Today": "Aujourd'hui", + "Yesterday": "Hier", + "3 days": "3 jours", + "7 days": "7 jours", + "15 days": "15 jours", + "30 days": "30 jours", + "3 months": "3 mois", + "6 months": "6 mois", + "1 year": "1 an" } diff --git a/src/locales/sk-SK.json b/src/locales/sk-SK.json index b6ae42c..5d3e3c1 100644 --- a/src/locales/sk-SK.json +++ b/src/locales/sk-SK.json @@ -32,5 +32,14 @@ "Battery": "Batéria", "Speed": "Rýchlosť", "Regions:": "Oblasti:", - "WiFi": "WiFi" + "WiFi": "WiFi", + "Today": "Dnes", + "Yesterday": "Včera", + "3 days": "3 dni", + "7 days": "7 dní", + "15 days": "15 dní", + "30 days": "30 dní", + "3 months": "3 mesiace", + "6 months": "6 mesiacov", + "1 year": "1 rok" } diff --git a/src/locales/tr-TR.json b/src/locales/tr-TR.json index 5181c98..40ff2ea 100644 --- a/src/locales/tr-TR.json +++ b/src/locales/tr-TR.json @@ -32,5 +32,14 @@ "Battery": "Batarya", "Speed": "Hız", "Regions:": "Bölgeler:", - "WiFi": "WiFi" + "WiFi": "WiFi", + "Today": "Bugün", + "Yesterday": "Dün", + "3 days": "3 gün", + "7 days": "7 gün", + "15 days": "15 gün", + "30 days": "30 gün", + "3 months": "3 ay", + "6 months": "6 ay", + "1 year": "1 yıl" }