Reputation: 32069
I have a SQL Server database field named 'JoiningDate' which has the type date (no time part here).To Capture the input from the user I am using ngx-bootstrap datepicker but the problem is that whenever I select a date from the datepicker, the datepicker itself converting the selected date into utc datetime as follows:
Sometimes it mismatches the date part due the utc time part.
My questions are:
Upvotes: 2
Views: 1786
Reputation: 321
You will need to write a simple function to convert the date object to the locale date string in format ("10/31/2018"), just as it is displayed in the input field:
convertDate(inputDate) {
// convert date received to locale string in 10/31/2018 format
const localeDate = inputDate.toLocaleDateString();
return localeDate;
}
Upvotes: 1