Skip to content

Commit

Permalink
feat(events): remove europeanDate, remove showWeekDay, add eventDateF…
Browse files Browse the repository at this point in the history
…ormat

Added the eventDateFormat field which allows much more flexibility, users can specify the specific
date format they want and in what order, rather than the fixed format previously used

BREAKING CHANGE: removes europeanDate and showWeekDay options, this will cause the date to display
differently and so the new option eventDateFormat will need setting.
  • Loading branch information
marksie1988 committed Jun 24, 2024
1 parent 3990c97 commit 1054cbe
Show file tree
Hide file tree
Showing 28 changed files with 315 additions and 478 deletions.
12 changes: 9 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
"customizations": {
"vscode": {
"settings": {
"[json]": {
"editor.tabSize": 4,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
},
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/bin/zsh"
Expand All @@ -20,12 +27,11 @@
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "always"
},
"eslint.validate": [
"typescript"
],
format
]
},
"extensions": [
"github.vscode-pull-request-github",
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/event.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Event Mode Options
showFullDayProgress boolean v1.7.0 ``false`` Enables the progress bar for full day events
showRelativeTime boolean v2.1.0 ``true`` Show relative time until the start of an event
showEventIcon boolean v2.2.3 ``false`` Show the entity icon before the event title
europeanDate boolean v2.2.3 ``false`` Show date for event days in european format
softLimit integer v2.7.0 Adds flexibility when ``maxEventCount`` is set, so if there is only e.g. 1 extra event it would be shown
showHiddenText boolean v3.3.0 ``true`` Show x hidden events when limited number of events selected
hiddenEventText string v3.3.0 ``localize('common.hiddenEventText')`` allows a user to change the text displayed for hidden events
Expand All @@ -21,4 +20,5 @@ Event Mode Options
showTimeRemaining boolean v7.3.0 ``false`` Show the amount of time remaining for an event
hoursOnSameLine boolean v7.3.0 ``false`` if set true will move hours to show on the same line as the summary.
showAllDayHours boolean v7.5.0 ``true`` Show "All Day" text under full day events
eventDateFormat string v9.0.0 ``ddd D MMM`` Set the date format for events
======================= ========== ======== ===========================================================================================================
1 change: 0 additions & 1 deletion docs/configuration/main.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Main Options
maxEventCount integer optional v0.9.0 ``0`` Maximum number of events to show; zero removes any limitation
showLocation boolean optional v0.3.0 ``true`` Show location link (right side)
showMonth boolean optional v0.3.0 ``false`` Show month under day (left side)
showWeekDay boolean optional v1.3.0 ``false`` Show week day under day (left side)
showLoader boolean optional v0.7.0 ``true`` Show animation, when events are being loaded from Google Calendar.
showDate boolean optional v0.7.2 ``false`` Show the date on the right side of the card name
startDaysAhead integer optional v0.7.3 ``0`` If you set more than 0, events will be loaded starting `x` days from today. For example `1` - the component will show events starting from tomorrow, if a negative number is used, events previous will be shown.
Expand Down
4 changes: 2 additions & 2 deletions rollup-dev.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ const plugins = [
export default {
input: ['./src/index.ts'],
output: {
file: 'dist/atomic-calendar-revive-dev.js',
file: 'dist/atomic-calendar-revive.js',
format: 'umd',
name: 'AtomicCalendarReviveDev',
name: 'AtomicCalendarRevive',
inlineDynamicImports: false,
},
watch: {
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ const plugins = [
export default {
input: ['./src/index.ts'],
output: {
file: 'dist/atomic-calendar-revive-dev.js',
file: 'dist/atomic-calendar-revive.js',
format: 'umd',
name: 'AtomicCalendarReviveDev',
name: 'AtomicCalendarRevive',
inlineDynamicImports: false,
},
watch: {
Expand Down
3 changes: 1 addition & 2 deletions src/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default {

showLocation: true, // show location (right side)
showMonth: false, // show month under day (left side)
showWeekDay: false, // show day name under day (left side)
fullTextTime: true, // show advanced time messages, like: All day, until Friday 12
showCurrentEventLine: false, // show a line between last and next event
showDate: false,
Expand Down Expand Up @@ -83,7 +82,7 @@ export default {
refreshInterval: 60,

showEventIcon: false,
europeanDate: false,
eventDateFormat: 'ddd D MMM',
hideDuplicates: false,

showMultiDay: false,
Expand Down
12 changes: 6 additions & 6 deletions src/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,12 @@ export class AtomicCalendarReviveEditor extends ScopedRegistryHost(LitElement) i
name: 'hiddenEventText',
label: localize('event.fields.hiddenEventText'),
},
{
type: 'text',
name: 'eventDateFormat',
label: localize('event.fields.eventDateFormat'),
default: defaultConfig.eventDateFormat,
},
{
type: 'switch',
name: 'showCurrentEventLine',
Expand All @@ -441,12 +447,6 @@ export class AtomicCalendarReviveEditor extends ScopedRegistryHost(LitElement) i
label: localize('event.fields.showMonth'),
default: defaultConfig.showMonth,
},
{
type: 'switch',
name: 'showWeekDay',
label: localize('event.fields.showWeekDay'),
default: defaultConfig.showWeekDay,
},
{
type: 'switch',
name: 'showDescription',
Expand Down
20 changes: 4 additions & 16 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,31 +426,19 @@ export class AtomicCalendarRevive extends LitElement {
const showDatePerEvent = this._config.showDatePerEvent ? true : !!(i === 0);

// check and set the date format
const showMonth =
showDatePerEvent && this._config.showMonth
? html`<div class="event-date-month">${event.startTimeToShow.format('MMM')}</div>`
: '';
const showDay = showDatePerEvent
? html`<div class="event-date-day">${event.startTimeToShow.format('DD')}</div>`
: '';
const eventDateFormat =
this._config.europeanDate === true ? html`${showDay} ${showMonth}` : html`${showMonth} ${showDay}`;
const eventDate = showDatePerEvent
? html`<div class="event-date-day">${event.startTimeToShow.format(this._config.eventDateFormat)}</div>`
: html``;

const dayClassTodayEvent = event.startTimeToShow.isSame(dayjs(), 'day') ? `current-day` : ``;
const compactMode = this._config.compactMode ? `compact` : ``;
const hideDate = this._config.showEventDate ? `` : `hide-date`;

const showWeekDay =
showDatePerEvent && this._config.showWeekDay
? html`<div class="event-date-week-day">${event.startTimeToShow.format('ddd')}</div>`
: '';
const eventLeft =
this._config.showEventDate === true
? html`<div class="event-left ${dayClassTodayEvent}">
<!--Show the weekday e.g. Mon / Tue -->
${showWeekDay}
<!--Show the event date, see eventDateFormat-->
${eventDateFormat}
${eventDate}
</div>`
: html``;
return html`<div class="single-event-container ${compactMode} ${dayWrap} ${hideDate}" style="${lastEventStyle}">
Expand Down
4 changes: 2 additions & 2 deletions src/localize/languages/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"showCurrentEventLine": "Mostrar línia abans de l'esdeveniment?",
"showProgressBar": "Mostrar barra de progrés?",
"showMonth": "Mostrar mes?",
"showWeekDay": "Mostrar dia de la setmana",
"showDescription": "Mostrar descripció?",
"disableEventLink": "Desactivar enllaços al títol de l'esdeveniment?",
"disableLocationLink": "Desactivar enllaços a la localització?",
Expand All @@ -85,7 +84,8 @@
"showDatePerEvent": "Mostrar data al costat de cada esdeveniment",
"showTimeRemaining": "Mostrar temps restant",
"showAllDayHours": "Mostrar text d'esdeveniment de tot el dia",
"hoursOnSameLine": "Mostrar hores a la línia de l'esdeveniment"
"hoursOnSameLine": "Mostrar hores a la línia de l'esdeveniment",
"eventDateFormat": "Format de data de l'esdeveniment"
}
},
"calendar": {
Expand Down
4 changes: 2 additions & 2 deletions src/localize/languages/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
"showCurrentEventLine": "Zobrazit řádek před událostí",
"showProgressBar": "Zobrazit průběh",
"showMonth": "Zobrazit měsíc",
"showWeekDay": "Zobrazit den v týdnu",
"showDescription": "Zobrazit popisek",
"disableEventLink": "Zakázat odkazy v titulku události",
"disableLocationLink": "Zakázat odkazy na lokace",
Expand All @@ -74,7 +73,8 @@
"showCalendarName": "Zobrazit název kalendáře",
"showWeekNumber": "Zobrazit číslo týdne",
"showEventDate": "Zobrazit datum události",
"showDatePerEvent": "Zobrazit datum u každé události"
"showDatePerEvent": "Zobrazit datum u každé události",
"eventDateFormat": "Formát data události"
}
},
"calendar": {
Expand Down
4 changes: 2 additions & 2 deletions src/localize/languages/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"showCurrentEventLine": "Vis en linie før aftale?",
"showProgressBar": "Vis status bar?",
"showMonth": "Vis måned?",
"showWeekDay": "Vis ugedag",
"showDescription": "Vis beskrivelse?",
"disableEventLink": "Fjern link i titel på aftale?",
"disableLocationLink": "Fjern link på placering?",
Expand All @@ -85,7 +84,8 @@
"showDatePerEvent": "Vis dato ud for hver begivenhed",
"showTimeRemaining": "Vis resterende tid",
"showAllDayHours": "Vis Heldagsbegivenhedstekst",
"hoursOnSameLine": "Vis timer på begivenhedslinjen"
"hoursOnSameLine": "Vis timer på begivenhedslinjen",
"eventDateFormat": "Begivenhedsdatoformat"
}
},
"calendar": {
Expand Down
4 changes: 2 additions & 2 deletions src/localize/languages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"showCurrentEventLine": "Linie vor einem Eintrag anzeigen?",
"showProgressBar": "Fortschrittsbalken anzeigen?",
"showMonth": "Monat anzeigen?",
"showWeekDay": "Wochentag anzeigen?",
"showDescription": "Beschreibung anzeigen?",
"disableEventLink": "Links im Ereignistitel deaktivieren?",
"disableLocationLink": "Links zum Ort deaktivieren?",
Expand All @@ -85,7 +84,8 @@
"showDatePerEvent": "Datum neben dem jeweiligen Ereignis anzeigen?",
"showTimeRemaining": "Verbleibende Zeit anzeigen?",
"showAllDayHours": "Ganztägigen Ereignistext anzeigen?",
"hoursOnSameLine": "Stunden auf der Ereigniszeile anzeigen?"
"hoursOnSameLine": "Stunden auf der Ereigniszeile anzeigen?",
"eventDateFormat": "Ereignisdatumsformat"
}
},
"calendar": {
Expand Down
4 changes: 2 additions & 2 deletions src/localize/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"showCurrentEventLine": "Show line before event?",
"showProgressBar": "Show progress bar?",
"showMonth": "Show month?",
"showWeekDay": "Show Week Day",
"showDescription": "Show Description?",
"disableEventLink": "Disable links in event title?",
"disableLocationLink": "Disable links to location?",
Expand All @@ -85,7 +84,8 @@
"showDatePerEvent": "Show date next to each event",
"showTimeRemaining": "Show time remaining",
"showAllDayHours": "Show All Day event text",
"hoursOnSameLine": "Show hours on the event line"
"hoursOnSameLine": "Show hours on the event line",
"eventDateFormat": "Event date format"
}
},
"calendar": {
Expand Down
4 changes: 2 additions & 2 deletions src/localize/languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"showCurrentEventLine": "¿Mostrar línea antes del evento?",
"showProgressBar": "¿Mostrar barra de progreso?",
"showMonth": "¿Mostrar mes?",
"showWeekDay": "¿Mostrar día de la semana?",
"showDescription": "¿Mostrar descripción?",
"disableEventLink": "¿Desactivar enlaces en el título del evento?",
"disableLocationLink": "¿Desactivar enlaces a la ubicación?",
Expand All @@ -85,7 +84,8 @@
"showDatePerEvent": "¿Mostrar fecha junto a cada evento?",
"showTimeRemaining": "¿Mostrar tiempo restante?",
"showAllDayHours": "¿Mostrar texto de evento de todo el día?",
"hoursOnSameLine": "¿Mostrar horas en la línea de evento?"
"hoursOnSameLine": "¿Mostrar horas en la línea de evento?",
"eventDateFormat": "Formato de fecha del evento"
}
},
"calendar": {
Expand Down
4 changes: 2 additions & 2 deletions src/localize/languages/et.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
"showCurrentEventLine": "Kas kuvada sündmuse ees eraldaja",
"showProgressBar": "Kas kuvada edenemise riba?",
"showMonth": "Kas kuvada kuu?",
"showWeekDay": "Kuva nädalapäev",
"showDescription": "Kas kuvada kirjeldust?",
"disableEventLink": "Kas keelata viited sündmuse päises?",
"disableLocationLink": "Kas keelata asukoha viited?",
Expand All @@ -83,7 +82,8 @@
"showDatePerEvent": "Kuva kuupäev iga sündmuse kõrval",
"showTimeRemaining": "Näita järelejäänud aega",
"showAllDayHours": "Näita kogu päeva sündmuse teksti",
"hoursOnSameLine": "Näidake sündmuse reale tundi"
"hoursOnSameLine": "Näidake sündmuse reale tundi",
"eventDateFormat": "Sündmuse kuupäeva vorming"
}
},
"calendar": {
Expand Down
4 changes: 2 additions & 2 deletions src/localize/languages/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"showCurrentEventLine": "Näytetäänkö viiva ennen tapahtumaa?",
"showProgressBar": "Näytetäänkö edistymispalkki?",
"showMonth": "Näytä kuukausi?",
"showWeekDay": "Näytä viikonpäivä?",
"showDescription": "Näytä kuvaus?",
"disableEventLink": "Poistetaanko linkit käytöstä tapahtuman otsikossa?",
"disableLocationLink": "Poistetaanko sijaintilinkit käytöstä?",
Expand All @@ -85,7 +84,8 @@
"showDatePerEvent": "Näytä päivämäärä jokaisen tapahtuman vieressä",
"showTimeRemaining": "Näytä jäljellä oleva aika",
"showAllDayHours": "Näytä koko päivän tapahtuman teksti",
"hoursOnSameLine": "Näytä tunnit tapahtumarivillä"
"hoursOnSameLine": "Näytä tunnit tapahtumarivillä",
"eventDateFormat": "Tapahtuman päivämäärän muoto"
}
},
"calendar": {
Expand Down
4 changes: 2 additions & 2 deletions src/localize/languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"showCurrentEventLine": "Afficher une ligne avant l'événement?",
"showProgressBar": "Afficher la barre de progression?",
"showMonth": "Afficher le mois?",
"showWeekDay": "Afficher le jour de la semaine?",
"showDescription": "Afficher la description?",
"disableEventLink": "Désactiver les liens dans les titres d'événements?",
"disableLocationLink": "Désactiver les liens vers le lieu?",
Expand All @@ -85,7 +84,8 @@
"showDatePerEvent": "Afficher la date à côté de chaque événement",
"showTimeRemaining": "Afficher le temps restant",
"showAllDayHours": "Afficher le texte de l'événement toute la journée",
"hoursOnSameLine": "Afficher les heures sur la ligne de l'événement"
"hoursOnSameLine": "Afficher les heures sur la ligne de l'événement",
"eventDateFormat": "Format de la date de l'événement"
}
},
"calendar": {
Expand Down
4 changes: 2 additions & 2 deletions src/localize/languages/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"showCurrentEventLine": "Mutassunk vonalat az esemény előtt?",
"showProgressBar": "Mutassuk a folyamatjelzőt?",
"showMonth": "Mutassuk a hónapot?",
"showWeekDay": "Hét napjainak megjelenítése",
"showDescription": "Mutassuk a leírást?",
"disableEventLink": "Az esemény címén lévő link letiltása?",
"disableLocationLink": "A helyhez kapcsolódó link letiltása?",
Expand All @@ -85,7 +84,8 @@
"showDatePerEvent": "Dátum megjelenítése az események mellett",
"showTimeRemaining": "Hátralévő idő megjelenítése",
"showAllDayHours": "Egész napos esemény szöveg megjelenítése",
"hoursOnSameLine": "Az idő megjelenítése az esemény sorában"
"hoursOnSameLine": "Az idő megjelenítése az esemény sorában",
"eventDateFormat": "Esemény dátumának formátuma"
}
},
"calendar": {
Expand Down
4 changes: 2 additions & 2 deletions src/localize/languages/nb.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"showCurrentEventLine": "Vis en linje før hendelse?",
"showProgressBar": "Vis fremdriftsindikator?",
"showMonth": "Vis måned?",
"showWeekDay": "Vis ukedag?",
"showDescription": "Vis beskrivelse?",
"disableEventLink": "Fjern lenke i hendelsestittel?",
"disableLocationLink": "Fjern lenke til plassering?",
Expand All @@ -85,7 +84,8 @@
"showDatePerEvent": "Vis dato ved siden av hvert arrangement",
"showTimeRemaining": "Vis gjenværende tid",
"showAllDayHours": "Vis tekst for hele dagen",
"hoursOnSameLine": "Vis timer på arrangementslinjen"
"hoursOnSameLine": "Vis timer på arrangementslinjen",
"eventDateFormat": "Datoformat for hendelsen"
}
},
"calendar": {
Expand Down
4 changes: 2 additions & 2 deletions src/localize/languages/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"showCurrentEventLine": "Toon lijn voor evenement?",
"showProgressBar": "Toon voortgangsbalk?",
"showMonth": "Toon maand?",
"showWeekDay": "Toon Weekdag",
"showDescription": "Toon Beschrijving?",
"disableEventLink": "Schakel links in evenementstitel uit?",
"disableLocationLink": "Schakel links naar locatie uit?",
Expand All @@ -86,7 +85,8 @@
"showDatePerEvent": "Toon datum naast elk evenement",
"showTimeRemaining": "Toon resterende tijd",
"showAllDayHours": "Toon tekst voor hele dag evenementen",
"hoursOnSameLine": "Toon uren op de evenementlijn"
"hoursOnSameLine": "Toon uren op de evenementlijn",
"eventDateFormat": "Datumformaat evenement"
},
"calendar": {
"name": "Kalendermodus",
Expand Down
4 changes: 2 additions & 2 deletions src/localize/languages/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"showCurrentEventLine": "Mostrar linha antes do evento?",
"showProgressBar": "Mostrar linha de progresso?",
"showMonth": "Mostrar mês?",
"showWeekDay": "Mostrar dia da semana",
"showDescription": "Mostrar descrição?",
"disableEventLink": "Desativar links no titulo do evento?",
"disableLocationLink": "Desativar links para localização?",
Expand All @@ -85,7 +84,8 @@
"showDatePerEvent": "Mostrar data junto a cada evento",
"showTimeRemaining": "Mostrar tempo restante",
"showAllDayHours": "Mostrar texto evento dia completo",
"hoursOnSameLine": "Mostrar horas na linha do evento"
"hoursOnSameLine": "Mostrar horas na linha do evento",
"eventDateFormat": "Formato de data do evento"
}
},
"calendar": {
Expand Down
Loading

0 comments on commit 1054cbe

Please sign in to comment.