Daily Coding Challenge - Odd or Even Day

Tell us what’s happening:

There has to be a bug in the test cases because my code works perfectly (I tested it out on VS Code and Programmiz online compiler).

Your code so far

function oddOrEvenDay(timestamp) {

  let date = new Date(timestamp).getDate(); 

  //console.log(date)

  //if(date == 26){
    //date = date + 1; 
  //}

  if(date % 2 == 0){
    return "even"
  } else {
    return "odd"
  }

}

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36

Challenge Information:

Daily Coding Challenge - Odd or Even Day
https://www.freecodecamp.org/learn/daily-coding-challenge/2026-01-27

So far it keeps saying my output for test cases 1 and 5 are wrong, but my code is producing the correct output (test case 1 should return “odd” and 5 should return “even”) which it is, and when I did console.log(date) it returned a date that is one less than the correct answer for test case 1 (which should be 27, but “Date” returned 26), the commented out if-stmt was my attempt to cover this weird bug, but it messed up the result of test case 2.

There is nothing wrong with the tests. You are getting a local datetime from the timestamp. It needs to be UTC.