xts objects support many date classes for the index, but the as.xts function only explicitly checks for small subset of classes.
fortunately, the xts::timeBased function will perform this check properly
i.e. replace
if (!any((index_class <- class(x[[1L]])) %in% c("POSIXct", "Date")))
with:
if(!xts::timeBased(x[[1L]]))
xts objects support many date classes for the index, but the
as.xtsfunction only explicitly checks for small subset of classes.fortunately, the
xts::timeBasedfunction will perform this check properlyi.e. replace
if (!any((index_class <- class(x[[1L]])) %in% c("POSIXct", "Date")))with:
if(!xts::timeBased(x[[1L]]))