New Date() returns {} instead of current date

  • Goal:
    I have a function that is using the Date object from javascript in many places.
    The Date not being returned after creating a new date object like so
const currentDate = new Date()
console.log(currentDate)

Currently it returning {} when printing it out.
The expected behavior is to have it return the current correct date and not {}. {} is not usable and won't return any properties, because it's an empty object

  • Screenshots:

If you want to log the date to the console, you need to make it a string (not a date object) with console.log(String(currentDate)):

Thanks! Yeah I tried this the other day and it worked, but I wonder if the team is able to resolve logging the object itself. Could be tricky for new users who don't know how to do this

Hi @Drew_Gallagher, thank you for your feedback! I agree, this can be confusing for our users.

We just created the FR to log the date object without String conversion.

1 Like