The specified value does not conform to the required format yyyy-MM-dd

material-ui the specified value does not conform to the required format yyyy-mm-dd
jquery 3.3 1 js 8032 the specified value does not conform to the required format yyyy mm dd
does not conform to the required format yyyy-mm-dd laravel
input type date format dd-mm-yyyy
the specified value 0000-00-00 does not conform to the required format yyyy-mm-dd
the specified value dd mm yy does not conform to the required format yyyy mm dd
typescript format date mm/dd/yyyy
get date in yyyy mm dd format jquery

I have a .Net MVC 5 application that is using Data Annotations, Entity-Framework Jquery 2.1.3 and Jquery UI 1.11.4.

When I render an edit form with an input of type date using the UK format "dd/MM/YYYY"; the following error message appears when using Google Chrome:

The specified value '10/10/2001' does not conform to the required format, 'yyyy-MM-dd'. jquery-2.1.3.js:5317

Model

public class MyModel
{
    [Column(TypeName = "date"), DataType(DataType.Date), Display(Name = "My date")]
    [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}")]
    public string MyDate { get; set; }
}

Mark up

<input class="text-box single-line" data-val="true" data-val-date="The field My date must be a date." id="MyDate" name="MyDate" type="date" value="10/10/2001" />

The value is set correctly in the input control but the date does not appear in the browser. I first thought this was an issue with jQuery as it is appearing the jQuery script file, but when testing in IE and Firefox everything is working fine.

I then assumed it was my regional setting in chrome as by default Chrome thinks everyone English is in America, I changed the regional setting to UK and still the same issue appears.

A simple fix would be to change the format in my model to universal but to UK users this is a little alien.

Is there a way to tell chrome that accept date formats in "dd/MM/YYYY"?

The specifications for the HTML5 date picker state that the date must be in the format yyyy-MM-dd (ISO format). This means that you DisplayFormatAttribute must be

[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
public string MyDate { get; set; }

Alternatively you can manually add the format using

@Html.TextBoxFor(m => m.MyDate, "{0:yyyy-MM-dd}", new { @type = "date"  })

The later option allows you to keep the DataFormatString = "{0:dd/MM/yyyy}") for usage in @Html.DisplayFor()

datepicker specified value does not conform to the required format , What's worse its default value format is yyyy-mm-dd (see more on mdn) so if you change format jquery-ui datepicker sets value formatted as in  The specified value does not conform to the required format yyyy-MM-dd Hot Network Questions In most U.S. states, female genital mutilation is illegal.

You can use the InputTagHelper.Format

<input asp-for="MyDate" asp-format="{0:yyyy-MM-dd}" />

https://docs.asp.net/projects/api/en/latest/autoapi/Microsoft/AspNetCore/Mvc/TagHelpers/InputTagHelper/#prop-Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper.Format

unable to use a format other than yyyy-MM-dd (using jquery) · Issue , and in the console there is a warning from jquery: The specified value "Dec 25, 2015" does not conform to the required format, "yyyy-MM-dd". The specified value '06/07/2015' does not conform to the required format, 'yyyy-MM-dd'. I must use day-month-year format for my client needs. date kendo-ui datepicker format

The issue could be from the type="date". That was my situation anyway. Worked once it was changed to type="text". If the interface is built with an MVC wrapper, you need to replace or set the html attribute accordingly.

The specified value ':)' does not conform to the required format, 'yyyy , modernizr 2.8.3 on line 536. The specified value ':)' does not conform to the required format, 'yyyy-MM-dd'. modernizr.js:536 It looks like the I get these errors in the latest version of Google Chrome Canary (Version 39.0.2127.0 canary (64-bit)) The specified value ':)' does not conform to the required format, 'yyyy-MM-dd'. angular-slider.js:131 angular-slider.js:136 A similar

I'd like to highlight something in the answer here.

If you are building an application that has Globalization and Localization then the method of passing in a format using a Html helper will be better. You can also just use EditorFor and pass in the necessary id or class for datepicker.

[Solved] How to change date formate to yyyy-MM-dd in MVC , The specified value "11/24/2016" does not conform to the required format, "yyyy-​MM-dd". What I have tried: I tried to put @Html.TextBoxFor(m  The specifications for the HTML5 date picker state that the date must be in the format yyyy-MM-dd (ISO format). This means that you DisplayFormatAttribute must be [DisplayFormat(DataFormatString = The specified value does not conform to the required format yyyy-MM-dd

Set the type attribute to text.

@Html.TextBoxFor(m => m.MyDate, new { @type = "text"  })

Date does not conform to required format in jQuery. How can I fix this , "The specified value "6/10/2016" does not conform to the required format, "yyyy-​MM-dd"." I'm not sure how to fix it. I understand the concept, but  The picker text shows 'mm/dd/yyyy' and in the console there is a warning from jquery: The specified value "Dec 25, 2015" does not conform to the required format, "yyyy-MM-dd". This comment has been minimized.

HTML5 date and time attr does not conform to the required format , The specified value '10/10/2001′ does not conform to the required format, 'yyyy-​MM-dd'. jquery-2.1.3.js:5317. Model public class MyModel  The specified value does not conform to the required format yyyy-MM-dd Tag: jquery , asp.net-mvc , google-chrome , datetime , data-annotations I have a .Net MVC 5 application that is using Data Annotations, Entity-Framework Jquery 2.1.3 and Jquery UI 1.11.4.

Contact Form 7, The specified value '{{event.date_from | date: 'dd.MMM.yyyy'}}' does not conform to the required format, 'yyyy-MM-dd'. What I´m missing here? How to get date in yyyy-mm-dd format in datetime datatype How can I get a date in 'yyyy-mm-dd' format (2013-10-25) in a datetime object using C#? Change the date format

Contact Form 7 - The specified value does not conform to the required format, "​yyyy-MM-dd. If you have something like this shortcode for a date input on contact​  The specified value does not conform to the required format yyyy-MM-dd I have a .Net MVC 5 application that is using Data Annotations, Entity-Framework Jquery 2.1.3 and Jquery UI 1.11.4.

Comments
  • Are you wanting to render the browsers HTML5 datepicker implementation (or are you using a jquery plugin)?
  • I suggest you use datepicker ui so the ISO format is sent to the server while dd/MM/dddd will be configured at client side.
  • @StephenMuecke I was going to let the browser handle the date picker, so there is one less need for a third party library.
  • If your using the browser datepicker, your need to specifiy the attribute as [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyInEditMode = true)]. The browser will then display the value in the browsers locale settings, but post back the ISO format so it will be correctly bound. But note that this is only supported in modern browsers.
  • Doing this also renders the date in universal format when using DisplayFor() helper method
  • Is there any less janky workaround than using JS to reformat the box after loading the page? [DisplayFormat] causes jQuery to reset the field and give an invalid value message in the console. Formatting it in TextBoxFor solves this error (and allows me to apply my mask plugin), but still displays the date in ISO format. On domReady, I move the values around to use American formatting.
  • @Sinjai, Sorry, I don't understand your comment. [DisplayFormat] and jQuery are not related in anyway (it will not reset a value), and this question/answer relates to the browsers HTML-5 datepicker implementation (it has nothing to do with a mask plugin). If your having an issue, then ask a new question with the relevant details
  • Yeah, probably too much for an aside in a comment. I don't have any better way to word it for a question, though. jQuery is used in ASP.NET MVC projects for validation, and I presume that's what's freaking out. Console just says the error originates in jquery-version.js. Don't worry about it.
  • I know this is an old question but I'm hoping for an answer and it feels stupid writing a formal question about this... ApplyFormatInEditMode = true is used to keep the format in @Html.EditorFor() right? then howcome I still get that error (the one in the question) in the console when trying to fill an @Html.EditorFor() with a DateTime and [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)].... Any ideas? or am I confusing Edit mode with something else?
  • @FllnAngl, If its not working for you, then I can only assume you have other code, or something your not telling us that is causing the issue.
  • How can I do this only for Chrome. But not IE?