BUG: Bug in groupby dtype conversion with datetimelike (GH5869)

closes #5869