iazureenaa / Fitness-Frog

0 stars 0 forks source link

DatePicker validation message - "Date field must be date" #2

Closed iazureenaa closed 3 years ago

iazureenaa commented 3 years ago

image image image

Observation:

  1. Load page shows today date as expected
  2. DatePicker pop up and need to pick other date (today and future date unacceptable)
  3. Choose another date (previous date) and succeed
shakucing commented 3 years ago

try this way instead:

$(document).ready(function() { $("input.datepicker").datepicker({ format: "m/d/yyyy", }); });

iazureenaa commented 3 years ago

When inspect, the date field:

image

image

I was informed that data-val-date comes from unobtrusive validation

shakucing commented 3 years ago

pasting here updated info from @iazureenaa

"saya track ada 3 files yang guna date format: 1._EntryForm (dekat kamu as form (add.cshtml)) 2.Entry (Models folder)

  1. _Layout.cshtml

for date ni saya nak guna ToString utk customizekan date"

iazureenaa commented 3 years ago

Understanding the bug meaning -

Date field for today, future and a week is invalid for date (suspected because of MM and dd not in the same place) - meaning 05/31 is read as dd/MM.

iazureenaa commented 3 years ago

Fixed by adding culture inside system.web (web.config)

Solution: https://stackoverflow.com/questions/41631803/date-format-to-dd-mm-yyyy-in-textboxfor-type-date