public static DateTime Truncate(this DateTime date, TruncateTo truncateTo) => new DateTime(date.Ticks - date.Ticks % (long)truncateTo, date.Kind == DateTimeKind.Unspecified ? DateTimeKind.Local : date.Kind);
public static DateTime?Truncate(this DateTime?date, TruncateTo truncateTo) => date?.Truncate(truncateTo);