pass date and time as string js code example
Example 1: javascript date to string
const event = new Date(1993, 6, 28, 14, 39, 7);
console.log(event.toString());
console.log(event.toDateString());
Example 2: format date js
var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
var today = new Date();
console.log(today.toLocaleDateString("en-US"));
console.log(today.toLocaleDateString("en-US", options));
date.toLocaleDateString("en-US", { day: 'numeric' })+ "-"+ date.toLocaleDateString("en-US", { month: 'short' })+ "-" + date.toLocaleDateString("en-US", { year: 'numeric' })