I would like to display my timestamp in the front as the date. I tried several methods but none worked. here is the code:`
formulaire.addEventListener('submit', posteValidation);
/**
* Fonction pour ajouter une publication dans le serveur
* @param {Event} event
*/
const addPosteServeur = async (event) => {
event.preventDefault();
if(formulaire.checkValidity()){
let data = {
id_user: 1,
timestamps: date.getTime(),
text : textPoste.value
}
let response = await fetch('/', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(data)
});
if(response.ok){
addPosteClient({
id_user: 1,
timestamps: date.getTime(),
text: textPoste.value
});
textPoste.value = '';
}
}
}
formulaire.addEventListener('submit', addPosteServeur);`
Thanks
addPosteClientfunction and how it displays the timestamp. And what do node.js or express have to do with any of this?