My goal is to include a hidden input field on a landing page template that captures the date and time in the format of: YYYY-MM-DD HH:MM:SS for each form submission.
This is the hidden input field:
<input type="hidden" name="hidden_submit_date" v-model="now" />
Here is the Vue app logic I have implemented to determine the current date and time for submission:
const app = Vue.createApp({
data() {
return {
now: new Date("YYYY-MM-DDTHH:MM:SSZ")
};
},
methods: {
submitForm(e) {
const isValid =
this.contact.firstName ||
this.contact.lastName ||
this.contact.email;
if (!isValid) {
e.preventDefault();
}
}
}
});
Do I require a timeout function? Or is there an issue with the formatting within the Date() function? I'm uncertain about what needs to be adjusted.