'How can I filter a time period that includes midnight in dplyr?

I need to filter by a time period that includes midnight (i.e., 00:00:00). I am using dplyr to filter and all filters are working except the one including midnight (i.e., 21:00:00 - 03:59:50). I am sure this is a simple fix, but I can't figure it out. I am also unsure of what else to add to this post, but I keep getting the warning that I should add more detail because my post includes mostly code. Any advice? Thanks

###########worked fine
midday <- treat_used %>%
  filter(Time >= '09:00:00' & Time <= '16:59:59') %>%
  droplevels()

##############results in all NAs
night <- treat_used %>%
  filter(Time >= '21:00:00' & Time <= '03:59:59') %>%
  droplevels()
structure(list(Id = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L), .Label = c("151_230_25_2", "151_259_25_2", "151_290_75_2", 
"151_310_35_2", "151_335_35_2", "151_425_25_2", "151_570_55_2", 
"151_880_25_2"), class = "factor"), DateTime = structure(c(1226642400, 
1226644200, 1226646000, 1226647800, 1226649600, 1226651400, 1226653200, 
1226655000, 1226656800, 1226658600), class = c("POSIXct", "POSIXt"
), tzone = "CST6CDT"), Date = c("11/14/2008", "11/14/2008", "11/14/2008", 
"11/14/2008", "11/14/2008", "11/14/2008", "11/14/2008", "11/14/2008", 
"11/14/2008", "11/14/2008"), Time = c("00:00:00", "00:30:00", 
"01:00:00", "01:30:00", "02:00:00", "02:30:00", "03:00:00", "03:30:00", 
"04:00:00", "04:30:00"), Altitude = c(0.48, 9.632, 5.332, -21.593, 
0.671, 3.402, -16.187, -0.48, 31.691, -5.847), Temp = c("18.5", 
"18", "16", "15.5", "15.5", "16", "16.5", "17", "17", "17"), 
    DOP = c(1.7, 2.1, 2.1, 3.8, 2.5, 3.2, 2.4, 1.9, 1.8, 1.5), 
    Year = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L
    ), .Label = "2", class = "factor"), Sex = structure(c(1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "M", class = "factor"), 
    Burst = c(149, 149, 149, 149, 149, 149, 149, 149, 149, 149
    ), dist = c(0.000252079074890173, 0.00109818510735411, 0.000425215239623984, 
    0.000966845313375102, 0.000290363668518633, 4.11311317659885e-05, 
    0.000104300191752328, 9.45943444411061e-05, 9.66201324770138e-05, 
    0.000671413136602357), dt = c(1800, 1800, 1800, 1800, 1800, 
    1800, 1800, 1800, 1800, 1800), speed = c(1.40043930494541e-07, 
    6.10102837418951e-07, 2.36230688679991e-07, 5.3713628520839e-07, 
    1.61313149177019e-07, 2.28506287588825e-08, 5.79445509735157e-08, 
    5.25524135783923e-08, 5.36778513761188e-08, 3.73007298112421e-07
    ), dist.1 = c(0.000252079074890173, 0.00109818510735411, 
    0.000425215239623984, 0.000966845313375102, 0.000290363668518633, 
    4.11311317659885e-05, 0.000104300191752328, 9.45943444411061e-05, 
    9.66201324770138e-05, 0.000671413136602357), dt.1 = c(1800, 
    1800, 1800, 1800, 1800, 1800, 1800, 1800, 1800, 1800), speed.1 = c(1.40043930494541e-07, 
    6.10102837418951e-07, 2.36230688679991e-07, 5.3713628520839e-07, 
    1.61313149177019e-07, 2.28506287588825e-08, 5.79445509735157e-08, 
    5.25524135783923e-08, 5.36778513761188e-08, 3.73007298112421e-07
    ), abs.angle = c(87.8402061599626, 114.688779369797, 232.645013272907, 
    318.748850092471, 251.839609551388, 272.229366886133, 44.6504029706826, 
    211.909077081116, 343.834675406086, 90.3584139633969), rel.angle = c(NA, 
    26.8485732098345, 117.95623390311, 86.1038368195645, 293.090759458916, 
    20.3897573347455, 132.421036084549, 167.258674110433, 131.925598324971, 
    106.52373855731), Latitude = c(27.4559686, 27.4559781, 27.4555194, 
    27.4552614, 27.4559883, 27.4558978, 27.4558994, 27.4559736, 
    27.4558933, 27.4559861), Longitude = c(-97.6410861, -97.6408342, 
    -97.6398364, -97.6401744, -97.6408119, -97.6410878, -97.6411289, 
    -97.6410556, -97.6411056, -97.6411325), Treatment_Type = structure(c(2L, 
    2L, 2L, 3L, 2L, 2L, 2L, 2L, 2L, 1L), .Label = c("1", "2", 
    "3"), class = "factor"), geometry = structure(list(structure(c(634284.139374602, 
    3037673.91290574), class = c("XY", "POINT", "sfg")), structure(c(634309.02263064, 
    3037675.23766835), class = c("XY", "POINT", "sfg")), structure(c(634408.189513259, 
    3037625.49997105), class = c("XY", "POINT", "sfg")), structure(c(634375.098333266, 
    3037596.55193961), class = c("XY", "POINT", "sfg")), structure(c(634311.214132757, 
    3037676.39177911), class = c("XY", "POINT", "sfg")), structure(c(634284.057155053, 
    3037666.06752916), class = c("XY", "POINT", "sfg")), structure(c(634279.993383785, 
    3037666.20035907), class = c("XY", "POINT", "sfg")), structure(c(634287.147569423, 
    3037674.49979658), class = c("XY", "POINT", "sfg")), structure(c(634282.303468411, 
    3037665.54975887), class = c("XY", "POINT", "sfg")), structure(c(634279.532552284, 
    3037675.80147953), class = c("XY", "POINT", "sfg"))), class = c("sfc_POINT", 
    "sfc"), precision = 0, bbox = structure(c(xmin = 634279.532552284, 
    ymin = 3037596.55193961, xmax = 634408.189513259, ymax = 3037676.39177911
    ), class = "bbox"), crs = structure(list(input = "+proj=utm +zone=14 +datum=NAD83 +units=m +no_defs", 
        wkt = "PROJCRS[\"unknown\",\n    BASEGEOGCRS[\"unknown\",\n        DATUM[\"North American Datum 1983\",\n            ELLIPSOID[\"GRS 1980\",6378137,298.257222101,\n                LENGTHUNIT[\"metre\",1]],\n            ID[\"EPSG\",6269]],\n        PRIMEM[\"Greenwich\",0,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8901]]],\n    CONVERSION[\"UTM zone 14N\",\n        METHOD[\"Transverse Mercator\",\n            ID[\"EPSG\",9807]],\n        PARAMETER[\"Latitude of natural origin\",0,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8801]],\n        PARAMETER[\"Longitude of natural origin\",-99,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8802]],\n        PARAMETER[\"Scale factor at natural origin\",0.9996,\n            SCALEUNIT[\"unity\",1],\n            ID[\"EPSG\",8805]],\n        PARAMETER[\"False easting\",500000,\n            LENGTHUNIT[\"metre\",1],\n            ID[\"EPSG\",8806]],\n        PARAMETER[\"False northing\",0,\n            LENGTHUNIT[\"metre\",1],\n            ID[\"EPSG\",8807]],\n        ID[\"EPSG\",16014]],\n    CS[Cartesian,2],\n        AXIS[\"(E)\",east,\n            ORDER[1],\n            LENGTHUNIT[\"metre\",1,\n                ID[\"EPSG\",9001]]],\n        AXIS[\"(N)\",north,\n            ORDER[2],\n            LENGTHUNIT[\"metre\",1,\n                ID[\"EPSG\",9001]]]]"), class = "crs"), n_empty = 0L), 
    Used = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L
    ), .Label = "1", class = "factor"), Treatment = structure(c(3L, 
    3L, 3L, 1L, 3L, 3L, 3L, 3L, 3L, 2L), .Label = c("brush", 
    "mottes", "root-plowed"), class = "factor")), sf_column = "geometry", agr = structure(c(Id = NA_integer_, 
DateTime = NA_integer_, Date = NA_integer_, Time = NA_integer_, 
Altitude = NA_integer_, Temp = NA_integer_, DOP = NA_integer_, 
Year = NA_integer_, Sex = NA_integer_, Burst = NA_integer_, dist = NA_integer_, 
dt = NA_integer_, speed = NA_integer_, dist.1 = NA_integer_, 
dt.1 = NA_integer_, speed.1 = NA_integer_, abs.angle = NA_integer_, 
rel.angle = NA_integer_, Latitude = NA_integer_, Longitude = NA_integer_, 
Treatment_Type = NA_integer_), .Label = c("constant", "aggregate", 
"identity"), class = "factor"), row.names = c(NA, 10L), class = "data.frame")


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source