-
Notifications
You must be signed in to change notification settings - Fork 2
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
Support TimeSpan
construction from Dates.CompoundPeriod
, Dates.Period
#57
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e79c0bf
support construction from periods
hannahilea ce470c2
bump version
hannahilea 4f7139a
support different start, stop types
hannahilea 6c071a7
use compat and dates.convert
hannahilea 3e3a834
more tests
hannahilea a5ae271
make inner constructor outer constructor
hannahilea File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 wonder if we should just always convert? That is the default behavior when you don't have an inner constructor, for example;
You can see in the stacktrace that it tries to call
convert
. But if you have an inner constructor, it calls that and doesn't have the default constructor w/ convert:I believe we have the inner constructor to do the
start == stop
case, but I don't think we were aiming to get rid of the convert constructors. So I think just auto-converting when we don't hit the::Nanosecond
one might be the best approach:Note that
convert(Nanosecond, Nanosecond(1))
works, so even ifstart::CompoundPeriod
andstop::Nanosecond
, the extra convert should be harmless.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.
we should! we weren't b/c I thought that Alex's "Compat" fix wasn't working, because I didn't implement it correctly :lol-cry:. BUT the most recent implementation does what you're suggesting, I think---take a look.
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.
oh hang on! let me reread
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.
ah oops, yeah, agree w/ the current implementation!
I was suggesting something different (always
convert
) but I missed that we already hadin the code base, in which case using the constructor (
Nanosecond()
) instead ofconvert
makes sense as the fallback. Ok agreed with what we have!