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

Removing current time indicator #7

Open
RoshanPShetty opened this issue Jul 3, 2021 · 4 comments
Open

Removing current time indicator #7

RoshanPShetty opened this issue Jul 3, 2021 · 4 comments

Comments

@RoshanPShetty
Copy link

Hi @pvictor. The current time indicator isn't shown when it isn't the systems date/time. But when it is, then it is shown. So is it possible to remove the current time indicator from the calendar? If so, could you please indicate how it is done?

Here is a snippet when the defaultDate is NOT Sys.Date():
image

Here is a snippet when the defaultDate is Sys.Date():
image

@pvictor
Copy link
Member

pvictor commented Jul 5, 2021

Hello,

There isn't a built-in option to do that, so a workaround is to use theme and template like this:

calendar(view = "week") %>% 
      cal_theme(
        week.currentTimeLinePast.border = "none",
        week.currentTimeLineBullet.backgroundColor = "transparent",
        week.currentTimeLineToday.border = "none",
        week.currentTimeLineFuture.border = "none"
      ) %>% 
      cal_template(
        timegridCurrentTime = JS(
          "function() {return null;}"
        )
      )

Note that the regular hour is missing, you can make it reappear with some CSS:

.tui-full-calendar-timegrid-hour span {
    display: block !important;
}

In Shiny for example, include somewhere in your UI the following code:

tags$style(
    ".tui-full-calendar-timegrid-hour span {display: block !important;}"
  )

Victor

@RoshanPShetty
Copy link
Author

Hi @pvictor . Thank you for such a creative solution. However, there is one minor issue with that. Although it gets rid of the indicator, if the time has passed, then the calendar looks like this:

image

Would I need to work with CSS to bring it back to its original state?

image

@pvictor
Copy link
Member

pvictor commented Jul 6, 2021

You can add

week.pastDay.color = "#000",
week.pastTime.color = "#000"

in cal_theme() to set color for past time and days to black.

@RoshanPShetty
Copy link
Author

Thank you!

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

No branches or pull requests

2 participants