File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -483,6 +483,8 @@ async def get_next_period(
483483 self ,
484484 interval : TimeDeltaLike ,
485485 start : time | datetime | str | None = None ,
486+ * ,
487+ immediate : bool = False ,
486488 ) -> datetime :
487489 interval = utils .parse_timedelta (interval )
488490 start = "now" if start is None else start
@@ -493,7 +495,7 @@ async def get_next_period(
493495 assert isinstance (aware_start , datetime ) and aware_start .tzinfo is not None
494496
495497 # Skip forward to the next period if start is in the past
496- while aware_start < now :
498+ while aware_start < now or ( immediate and aware_start <= now ) :
497499 aware_start += interval
498500
499501 return aware_start
@@ -901,7 +903,7 @@ async def parse_datetime(
901903 # Need to force timezone during time-travel mode
902904 if now is None :
903905 now = await self .get_now ()
904- now = now . astimezone ( self .AD .tz )
906+ now = utils . ensure_timezone ( now , self .AD .tz )
905907 return parse .parse_datetime (
906908 input_ = input_ ,
907909 now = now ,
You can’t perform that action at this time.
0 commit comments