With data.table 1.16.2
library(data.table)
x <- c(a = "2019-01-01")
x
#> a
#> "2019-01-01"
as.IDate(x)
#> [1] "2019-01-01"
# data.table:::as.IDate.Date calls this
# as.integer() step loses names
as.integer(as.Date(x))
#> [1] 17897
Created on 2025-08-14 with reprex v2.1.1
With data.table 1.16.2
Created on 2025-08-14 with reprex v2.1.1