I would like to explain my problem of the day.
In the following code, everything works properly. The problem is I receive the "created" in the following format:
"created": "2020-02-18T13:45:01.652Z"
but I would only like to recover the time if possible without the seconds:
postbackend = () => {
const config = {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
...this.state,
items: newItems,
created: new
Date().toISOString()
}),
};
const url = entrypoint + "/alluserpls";
fetch(url, config)
.then(res => res.json())
.then(res => {
if (res.error) {
alert(res.error);
} else {
alert(`ajouté avec l'ID ${res}!`);
}
}).catch(e => {
console.error(e);
}).finally(() => this.setState({ redirect: true }));
}
Do you have an idea of how to fix this? Neff