-
Notifications
You must be signed in to change notification settings - Fork 966
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
Date precision #133
Date precision #133
Conversation
Now I'm confused! You mentioned before that you don't like the idea of having different strategies/calculators & you prefer to have only the precision-based implementation. But while reviewing this I found that you renamed IDistanceOfTimeInWords interface to be IDateTimeHumanizeStrategy ?! Can you clarify more what is our goal now? |
Hahaha, yeah that's what I meant by the We have two options here: we can either drop the current implementation and replace it with precision based with precision set to 1, which is not too bad, or keep the default one in there for backward compatibility perhaps and add the precision based in as a second algorithm. I like the first option better; but breaking the logic might lead into unexpected results for the existing users which is why I think having strategies in place is good, at least until we deprecate the default one. |
"until we deprecate the default one" this sounds good to me too. It works out approximation on all time parts/units, from the smaller to the bigger, then it calculates the final result based on the biggest unit. For example, if it's a year & 8 months & 23 days .. then
|
That's something I am trying to implement here too (still incomplete); but your algorithm is quite superior. I took your code and added a few tests on top and some of them failed; but I think your approach is much better. So I think we should try to fix it for the breaking tests and use that instead. If you are happy with the rest of this PR, do you think you can grab this, change the algorithm to use yours and fix the tests? That's so you get the credit for your awesome work and not me :) Also please add in a test for the case you gave above. If you have other issues with this PR please let's discuss them. |
Glad that you like the algorithm.. & Thanks for the credit :) The question now.. Why are we starting on a new PR? Why don't we rebase the original PR on top of the current master? What will I miss? or what do you like to change from this point? I guess it should be easier or what?! |
A few things made me create a new PR:
|
Okay. So I need to bring over the algorithm implementation & fix broken tests using current structure. Right? |
Yes please. |
I'm fixing tests now. The reason they're broken is the wrong assumption. Given the latest algorithm we talked about .. Agreed? do you like to change something about the precision calculation? |
I guess you might be looking at an old version of the PR. I had fixed the tests. Well at least I hope - unless I dreamt the whole thing!! #bites_finger #checking_now |
I hope not 😟 but I see the TeamCity Build also broken for unit tests! |
No, I am sure they're fixed. Just |
The unit tests are broken because I never completed the algorithm as we're going to use yours. Wanna pop on Skype? I'm www.mehdi-khalili.com |
Superseded by #165 |
Slightly based on #114 to implement #101
WIP - there are still a few failing tests for precision based tests; but want to get some code review on this first.