Reputation:
I have tried using US culture, GB culture, set in Mode format, for datepicker format(dd/mm/yyyy, dd/MM/yyyy, mm/dd/yyyy, MM/dd/YYYY) and language (US/GB) and nothing works !
Now I have something like this in a modeL
public DateTime? DueDate { get; set; }
in View:
@Html.TextBoxFor(model => model.Project.DueDate, new { @class = "form-control datepicker", placeholder = "Select due date" })
JS
$(function () { // will trigger when the document is ready $('.datepicker').datepicker({ //language: "en-GB", //dateFormat: '0:dd/mm/yyyy', autoclose: true }); //Initialise any date pickers });
Have been looking for a solution for 2 hours now and none of advice is not working given on forum. Keep getting ModelState invalid :/
Interesting fact is that if I will try to add
@Value = DateTime.Now.ToString("dd/mm/yyyy")
to my TextBoxFor I will get some crazy result 16/06/2016 which of course is wrong (current date set on my pc is 15/01/2016).
Please answer only if you have something valuable to say. Do not spam.
Upvotes: 0
Views: 422
Reputation:
Turned out that there was an issue with my workstation local settings, despite they were set to UK (time/language/locality/keyboard), system still showed US date format. (this was a new OS due to upgrade to new CPU (X99))
I guess it was a reason of weird behavior. Everything starts working after I've installed a fresh Win 10 copy (beside I had other unexplained issues on my previous OS (Win 7)). I guess it is time to start using Win 10...
Too bad that someone gave a minus just because he thinks that he knows everything (but couldn't provide a solution...). Interesting that almost every time I have no or horrible off topic response in here...
You are not too friendly huh...
Upvotes: 0