Build a Date Conversion Program - Build a Date Conversion Program

Tell us what’s happening:

my code is not passing the sixth checker and the code is correct

Your code so far

const currentDate = new Date();
const currentDateFormat = `Current Date and Time: ${currentDate}`;
console.log(currentDateFormat);
function formatDateMMDDYYYY(date) {
const mm = String(date.getMonth());
const dd = String(date.getDate());
const yyyy = date.getFullYear();
return `Formatted Date (MM/DD/YYYY): ${mm}/${dd}/${yyyy}`;
}
console.log(formatDateMMDDYYYY(currentDate))

function formatDateLong(date) {
  const mm = date.toLocaleString("en-Us", {month: "long"});
  const dd = String(date.getDate());
  const yyyy = date.getFullYear();
  return `Formatted Date (Month Day, Year): ${mm +" "+ dd + ", " + yyyy}`; 
}
console.log(formatDateLong(currentDate))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36

Challenge Information:

Build a Date Conversion Program - Build a Date Conversion Program
https://www.freecodecamp.org/learn/full-stack-developer/lab-date-conversion/lab-date-conversion

please i need help just the return message

Please be patient and stop spamming the forum.

Here are some troubleshooting steps you can follow. Focus on one test at a time:

  1. Are there any errors or messages in the console?
  2. What is the requirement of the first failing test?
  3. Check the related User Story and ensure it’s followed precisely.
  4. What line of code implements this?
  5. What is the result of the code and does it match the requirement? (Write the value of a variable to the console at that point in the code if needed.)

If this does not help you solve the problem, please reply with answers to these questions.

Hi @francisonah2018

What happens when you console log the date using the function mentioned in test 6?

Happy coding

I think the issue is with the month value. getMonth() actually starts from 0 (so January = 0). That’s why your month looks off by one. Try adding 1 and see if the last test passes. Hope this helps :slightly_smiling_face: