If you can post representative data (sufficient to reproduce the problem) it will be more likely to attract answers. See the FAQ: How to do a minimal reproducible example reprex
for beginners.
I suspect, in this case, that the problem lies in the argument to as.Date
, in which case just the character string of X.tmp$Date
is required.