Cannot use cut.POSIXct in Shiny

I want to use cut.POSIXct funtion in Shiny, but it got an eorror "'x' must be numeric".
Do you know why, and how to solve this problem?
Here is the code:

library(shiny)
library(readxl)

ui <- fluidPage(titlePanel("Calculation of 1h Data"),
sidebarLayout(
sidebarPanel(
fileInput("file", label = h3("File input"))
),
mainPanel(tableOutput("table")) )
)

server <- function(input, output) {

options(shiny.maxRequestSize=30*1024^2)

selectedData <- reactive({
inFile <- input$file
if (is.null(inFile))
return(NULL)
data <- read_xlsx(inFile$datapath, col_names = TRUE,na = "")
data$date<-format(as.POSIXct(data$date,"%Y/%m/%d %H:%M:%S"),"%Y/%m/%d
%H:%M:%S")
datat<-aggregate(. ~ cut(date, "1 hour"), data, mean)
})

output$table <- renderTable({
selectedData()})

}

shinyApp(ui, server)

What value are you passing to cut.POSIXct()? Can you post a reprex of your problem?