Fixed query date aggergation bug