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

Experiment: for each duration instance: store all date/time fields as zero-or-greater values and provide an positive/negative attribute #13

Open
jayaddison opened this issue Dec 4, 2022 · 1 comment

Comments

@jayaddison
Copy link
Owner

Attempt to implement the logic described by: #8 (comment)

Essentially:

  • Determine the 'time distance' described by the arguments provided
  • Store the positive values required to represent that
  • Store a flag to indicate whether the distance was positive or negative

With this in place, it should be possible to update the implementation of timedelta_isoformat.timedelta.isoformat(...) so that all of the designator-separated values it emits are positive.

@jayaddison
Copy link
Owner Author

Edge-case / potential conflict with year-and-month support:

Distances defined in terms of years/months are naturally ambiguous -- they only make sense when provided with a reference point and a calendar scheme (to determine leapyear frequencies and magnitude).

If year/month values are present and positive, and if any subtracted date/time elements are small enough to avoid turning the distance negative, then it's ok (albeit not completely unambiguous) to a positive representation of the entire distance, including year-and-month values.

It may be easiest to begin experimentation from a version of the code that does not support non-zero year/month values.

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

No branches or pull requests

1 participant