Skip to content

Commit

Permalink
Add a constant specifying the start hour for all relative calculation…
Browse files Browse the repository at this point in the history
…s when self.StartTimeFromSourceTime is False. By default it is 9 (am), as was used before.
  • Loading branch information
Andrew C. Martin committed Dec 23, 2017
1 parent 830775d commit f095cbd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions parsedatetime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ def _evalModifier(self, modifier, chunk1, chunk2, sourceTime):
startMinute = mn
startSecond = sec
else:
startHour = 9
startHour = self.ptc.StartHour
startMinute = 0
startSecond = 0

Expand Down Expand Up @@ -1142,7 +1142,7 @@ def _evalDayStr(self, datetimeString, sourceTime):
startMinute = mn
startSecond = sec
else:
startHour = 9
startHour = self.ptc.StartHour
startMinute = 0
startSecond = 0

Expand Down Expand Up @@ -2313,10 +2313,15 @@ def __init__(self, localeID=None, usePyICU=True,
self.BirthdayEpoch = 50

# When True the starting time for all relative calculations will come
# from the given SourceTime, otherwise it will be 9am
# from the given SourceTime, otherwise it will be self.StartHour

self.StartTimeFromSourceTime = False

# The hour of the day that will be used as the starting time for all
# relative calculations when self.StartTimeFromSourceTime is False

self.StartHour = 9

# YearParseStyle controls how we parse "Jun 12", i.e. dates that do
# not have a year present. The default is to compare the date given
# to the current date, and if prior, then assume the next year.
Expand Down

0 comments on commit f095cbd

Please sign in to comment.