Answer the question
In order to leave comments, you need to log in
How to reformat the date in the desired form?
Through the field, the date from the field gets into js (not a field specifically for the date, but a regular input). And there may be different forms, but for the api you need to reduce everything to YYYY-MM-DD (the api is not mine, I can’t change it). How to implement this in js without using a calendar?
Answer the question
In order to leave comments, you need to log in
The simplest thing is to include the moment library (or an analogue of day-fns, etc.)
to get the date in the required format:
const formatedDate = moment(sourceDate).format('YYYY-MM-DD')
const date = moment(dateString, 'DD-MM-YYYY')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question