Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar show ends only with duration #2968

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

kleinmantara
Copy link

I added a showEndsOnlyWithDuration calendar option to show only end times with a duration.

image

More details: https://forum.magicmirror.builders/topic/17380/calendar-event-same-start-and-enddate-wrong-google-calendar

Copy link
Collaborator

@rejas rejas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for the PR, but needs a little work.

@@ -18,6 +18,6 @@

.calendar .time {
padding-left: 30px;
text-align: right;
text-align: left;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will break layout of old configs, please dont

@@ -317,7 +318,11 @@ Module.register("calendar", {

// Add endDate to dataheaders if showEnd is enabled
if (this.config.showEnd) {
timeWrapper.innerHTML += " - " + moment(event.endDate, "x").format("LT");
if(this.config.showEndsOnlyWithDuration && event.startDate == event.endDate) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use "===" for comparison

@@ -336,8 +341,12 @@ Module.register("calendar", {
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").format(this.config.dateFormat));
// Add end time if showEnd
if (this.config.showEnd) {
timeWrapper.innerHTML += "-";
timeWrapper.innerHTML += this.capFirst(moment(event.endDate, "x").format(this.config.dateEndFormat));
if(this.config.showEndsOnlyWithDuration && event.startDate == event.endDate) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use "===" for comparison

@@ -417,7 +417,8 @@ const CalendarUtils = {

endDate = moment(parseInt(startDate.format("x")) + duration, "x");
if (startDate.format("x") === endDate.format("x")) {
endDate = endDate.endOf("day");
// see https://forum.magicmirror.builders/topic/17380/calendar-event-same-start-and-enddate-wrong-google-calendar
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please describe in the comment why this gets removed, the link to the forum could one day be gone :-) And maybe remove the whole if-block since it isnt used anymore?

@khassel
Copy link
Collaborator

khassel commented Sep 9, 2023

@kleinmantara can you make the requested changes? Otherwise we will close this PR.

@bugsounet
Copy link
Contributor

@rejas can you push it in another (temp) branch ?

Author seams not respond

I will see what can i do with this for v2.26
I can't make cross repo from it

@khassel
Copy link
Collaborator

khassel commented Sep 30, 2023

@bugsounet

you can do git fetch origin pull/2968/head:local_branch which will fetch the PR in a local branch local_branch

@bugsounet
Copy link
Contributor

sure but not in my fork ;)

I have found it's ok :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants