6 kyu
Cookie Creator
101lpabst
Loading description...
Strings
Functional Programming
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
One space almost made me bald.
This sentence, besides making no sense, is not true because the number of days doesn't have to be clamped in the final tests.
Yea this threw me off as well. I had to go back and delete the code I wrote for this.
Someone fixed full tests, so sample tests are now completely wrong.
Fixed sample tests and enabled Node v12
Date issue,
new Date()
will give current date, but test expect year 2017. So how?I agree with the date issues. It is unclear what is expected for the date format and the tests fail and are unhelpful.
The date part is just atrocious. It's not even hard to do but the expectation is not clear. Especially since the unit tests assume some random date and the tests when attempting the solution expect today's date. But then the time is also pretty random - I honestly don't know what time the initial tests want. The others just use 00:00:00 which, while sensible, is not explained at any point in the description. And of course it doesn't match the example tests.
I spent a third of my time doing the solution and two thirds of it just trying to match the date to what was "expected". And the expectation is rather arbitrary - the date format in a cookie can use the output of Date#toUTCString() which matches the required RFC 2616 date format but that's not considered correct here for some reason.
Either the description should go into more detail in how the date is to be handled, or the tests should be more lenient.
JS This is all fine apart from the date calculation. Given a value of 20 and a final result of "expires=Mon Oct 02 2017 18:00:00;", I have to conclude that the start date is 12 September 2017 (12 Sept + 20 days = 2 Oct). Can someone explain how I am supposed to do the date calculation. The date now is 14/9/2018. ???
INPUT: visit null codewars.com /kata/test 20
OUTPUT: Expected: 'document.cookie = "visit=visit; expires=Mon Oct 02 2017 18:00:00; path=/kata/test; domain=codewars.com"'
hmm i have a question: is the date solved with Date.UTC(params)??
Approved
Some random tests are required to avoid hacky solutions :)
Added the random tests myself! ;)
Some example tests would be nice :)