Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

pgan002
Copy link

@pgan002 pgan002 commented Jan 23, 2018

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

@@ -55,9 +55,39 @@
)


class Specified:
def __init__(self, year, month, day, daytime, hour, minute, second, microsecond):
self.year = year

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.

Copy link
Author

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.

self.year = year
self.month = month
self.day = day
self.daytime = daytime

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?

Copy link
Author

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants