Date format in tooltip of ggplotly

I am using ggplotly to show an interactive time-series plot. The x axis is in date format, yet the hover tool tip in plotly is converting the date format to a numeric (screenshot attached). Any ideas on how to get the date to show as a proper date in the tooltip?

Below is a short piece of the code:
plotbycity<-df_postgres %>% group_by(city, date, bedroooms) %>%
filter(city %in% input$checkGroup & bedroooms==input$radio) %>%
summarise(count=n(),rent=median(rent)) %>%


Error handling

if (is.null(plotbycity)) return(NULL)

#dat <- dat[c(“rent”, “bedroooms”, “date”, “City”)]
#dat <- melt(dat,id.vars=c(“date”, “City”, “bedroooms”),na.rm=TRUE) #

draw the line plot using ggplot

gg <-ggplot(plotbycity, aes(x = date, y = rent, group = city, color = city,
text = paste('obs: ', count))) +


p <- ggplotly(gg, tooltip = c(“x”, “y”, “text”))

I’ve been searching for a solution to this and came across this question. I’ve been having the same problem recently, though it’s worked correctly in the past using the same R code. Perhaps a package update changed behavior? If you’ve found a solution I would be very interested to learn how you did it.

Hi Aaron, Yes it was answered in stackoverflow:

I have encountered the same issue, and noticed that the dates were correctly formatted when I use the development version of ggplot2 .
So devtools::install_github(‘tidyverse/ggplot2’)
did the trick for me

[1] ‘’