-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NC-462 Record which parts of date were specified by user #41
base: master
Are you sure you want to change the base?
Conversation
timestring/Date.py
Outdated
@@ -55,9 +55,39 @@ | |||
) | |||
|
|||
|
|||
class Specified: | |||
def __init__(self, year, month, day, daytime, hour, minute, second, microsecond): | |||
self.year = year |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'year' means more actual year value. We can assign default values to all arguments so that it is clear that these are flags not values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add type hinting like year: Boolean. I think default values would be a bit confusing.
timestring/Date.py
Outdated
self.year = year | ||
self.month = month | ||
self.day = day | ||
self.daytime = daytime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is daytime not included in hour, min, sec? Do we need this separately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"9 o'clock" does not specify daytime -- am or pm is inferred but not explicit.
Set "specified" in Unix timestramp and plus_(). Separate parsing of am/pm from o'clock. Parse 11:11:11 am
Record what part of the time was specified by the user. This is needed for https://iamplus.atlassian.net/browse/AE-5159.
This solution uses output flags to describe the state of all components of a date and time reference (year, month, hour ,etc.) as either specified or not. This is similar to
parsedatetime
.The specified fields are represented using a new class. This is convenient but takes space. Should we use a binary representation like
5
=0000110
to represent that just hour and minute were specified?Required for https://github.com/iAmPlus/aneeda/pull/1351