6 kyu

Cookie Creator

Description
Loading description...
Strings
Functional Programming
Algorithms
  • Please sign in or sign up to leave a comment.
  • dfhwze Avatar
    • Why would you not log the entire actual and expected values in sample tests, like in the test cases?
    • Logging the actual and expected values on a single line is not user friendly for debugging
  • laurelis24 Avatar

    One space almost made me bald.

  • RealKenshiro Avatar

    OR a number of days, passed as an integer (if passed the integer 30 => create your own date string that is 30 days from now).

    This sentence, besides making no sense, is not true because the number of days doesn't have to be clamped in the final tests.

  • MobulaKuhlii Avatar

    Someone fixed full tests, so sample tests are now completely wrong.

  • asmyshlyaev177 Avatar

    Date issue, new Date() will give current date, but test expect year 2017. So how?

  • pjmsullivan Avatar

    I agree with the date issues. It is unclear what is expected for the date format and the tests fail and are unhelpful.

  • VLAZ Avatar

    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.

  • glynester Avatar

    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"'

  • skeletoo Avatar

    hmm i have a question: is the date solved with Date.UTC(params)??

  • Voile Avatar

    Approved

  • CodeVortex Avatar

    Some random tests are required to avoid hacky solutions :)

  • Voile Avatar

    Some example tests would be nice :)