https://www.freecodecamp.com/challenges/friendly-date-ranges
Problem constraints are a little unclear/contradictory and test assertions are problematic (see below):
The last 2 constraints are:
(["2022-09-05", "2023-09-04"]) should return ["September 5th, 2022","September 4th"].
and:
(["2022-09-05", "2023-09-05"]) should return ["September 5th, 2022","September 5th, 2023"].
These are the same sets of dates, except in one the second date is Sept. 4 while the other is Sept. 5, but the expected results for each from the function are different in how they include the years. I don't know how to satisfy this constraint without hardcoding it, which I did.
Because they are a year apart, I would assume both should include the year in the answer for clarity.
It is also unclear in the instructions when to include the year and where (in the first or second entry on the answer). For example, the instructions indicate "if the date range begins in the current year and ends within one year, the year should not be displayed at the beginning of the friendly range", however one of the test conditions asserts this answer: ["March 1st, 2017","May 5th"], which seems to be the opposite.
Overall, I think more clarity and consistency between the instructions and test conditions is needed to improve this challenge.
@bonham000 thanks for the feedback but I feel that there is consistency within the instructions and tests.
The example
(["2022-09-05", "2023-09-04"]) should return ["September 5th, 2022","September 4th"].
is less than a year apart so "if the date range ends in less than a year from when it begins, do not display the ending year."
The example,
(["2022-09-05", "2023-09-05"]) should return ["September 5th, 2022","September 5th, 2023"].
is a year long (i.e. not less than a year long to satisfy the first condition), doesn't begin in the current year (i.e. doesn't satisfy the second condition), and doesn't end in the same month it begins (i.e. fails the third condition). Thus this second case does require years on both the beginning and end of the range.
For the ["March 1st, 2017","May 5th"] example, the instructions state:
Additionally, if the date range begins in the current year and ends within one year, the year should not be displayed at the beginning of the friendly range.
The current year being 2016 right now so the beginning year can be displayed. This last example does satisfy the first condition of: "if the date range ends in less than a year from when it begins, do not display the ending year." The requirements for this challenge using the "current year" will probably have to be changed in the next year to be consistent.
I do admit that this challenge is quite complex and there are lots of things to consider. However, this challenge is within the Advanced Algorithm Scripting section so I think its complexity is fitting. Do you know any particular part of the challenge you could suggest changes to in order to make it more clear?
Eric,
Thank you for the quick response, I've looked over your explanation and it
does make a lot more sense now. I was assuming the 'current year' for each
pair was the referring to the first of the two entries, e.g for
(["2022-09-05", "2023-09-05"])
the current year would be 2022. Perhaps an example could be added to
clarify this point.
I apologize for not looking more closely at the instructions! Thank you for
your response.
Best,
Sean
On Tue, May 31, 2016 at 1:44 AM, Eric Leung [email protected]
wrote:
@bonham000 https://github.com/bonham000 thanks for the feedback but I
feel that there is consistency within the instructions and tests.The example
(["2022-09-05", "2023-09-04"]) should return ["September 5th,
2022","September 4th"].is less than a year apart so "if the date range _ends in less than a year_
from when it begins, do not display the ending year."The example,
(["2022-09-05", "2023-09-05"]) should return ["September 5th,
2022","September 5th, 2023"].is a year long (i.e. not less than a year long to satisfy the first
condition), doesn't begin in the current year (i.e. doesn't satisfy the
second condition), and doesn't end in the same month it begins (i.e. fails
the third condition). Thus this second case does require years on both the
beginning and end of the range.For the ["March 1st, 2017","May 5th"] example, the instructions state:
Additionally, if the date range _begins in the current year_ and ends
within one year, the year should not be displayed at the beginning of the
friendly range.The current year being 2016 right now so the beginning year can be
displayed. This last example does satisfy the first condition of: "if the
date range ends in less than a year from when it begins, do not display the
ending year." The requirements for this challenge using the "current year"
will probably have to be changed in the next year to be consistent.I do admit that this challenge is quite complex and there are lots of
things to consider. However, this challenge is within the Advanced
Algorithm Scripting section so I think its complexity is fitting. Do you
know any particular part of the challenge you could suggest changes to in
order to make it more clear?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/FreeCodeCamp/FreeCodeCamp/issues/8866#issuecomment-222596982,
or mute the thread
https://github.com/notifications/unsubscribe/ARSXf6Eqmt0nUZS3FqJIAFseLPSPD9Wpks5qG8qjgaJpZM4IqL4v
.
@bonham000 thanks for the feedback. That mention of the "current year" is a bit vague. We could add a little note mentioning the actual current year like this:
Additionally, if the date range begins in the current year (i.e. it is currently year 2016) and ends within one year, the year should not be displayed at the beginning of the friendly range.
I'm not sure how else to better indicate this.
That looks really good to me!
On 5/31/16, Eric Leung [email protected] wrote:
@bonham000 thanks for the feedback. That mention of the "current year" is a
bit vague. We could add a little note mentioning the actual current year
like this:Additionally, if the date range begins in the current year (i.e. it is
currently year 2016) and ends within one year, the year should not be
displayed at the beginning of the friendly range.I'm not sure how else to better indicate this.
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
https://github.com/FreeCodeCamp/FreeCodeCamp/issues/8866#issuecomment-222720277
For those wanting to help fix this issue, this line needs to be changed to:
"Additionally, if the date range begins in the <em>current year</em> (i.e. it is currently the year 2016) and ends within one year, the year should not be displayed at the <em>beginning</em> of the friendly range.",
Please first read the contributing guidelines before taking care of this issue. And feel free to visit the Contributors Help chat room if you have any questions about helping. We're there to help.
I can give this a try
Most helpful comment
@bonham000 thanks for the feedback. That mention of the "current year" is a bit vague. We could add a little note mentioning the actual current year like this:
I'm not sure how else to better indicate this.