Похожие чаты

How to fix this ? The value '22/10/2020' is not valid

for Birthday.

public DateTime Birthday { get; set; }

<input id="Birthday" name="Birthday" type="text" class="form-control">

18 ответов

9 просмотров

Should you be using a text input?

Kazem- Автор вопроса
pete
Should you be using a text input?

I need to use text bcs of datetime input library

Is the birthday property part of your page model?

Kazem- Автор вопроса
Kazem- Автор вопроса
Kazem
Any way to fix ?

Use the DateTime.Parse method

I'm still not entirely sure what the problem is, but I'm willing to bet it has to do with the format. I can't do much with this. Check this out, and try a few other dates, like 11/10/2020.

Kazem- Автор вопроса
getAx
Use the DateTime.Parse method

Where ? I'm the type in viewmodel is DateTime but in view is text

Kazem- Автор вопроса
Kazem
Where ? I'm the type in viewmodel is DateTime but ...

Building on @getAx response. private DateTime _birthday; public DateTime Birthday { get => _birthday; set => _birthday = DateTime.Parse(value); } Edit: I'm having doubts about this.

Kazem- Автор вопроса
pete
Building on @getAx response. private DateTime _bi...

Looks good but how to pass it to my model ?

Kazem- Автор вопроса
Kazem
screenshot Getting error

I figured something like that might happen.

Kazem- Автор вопроса
pete
I figured something like that might happen.

how about this ? testing.. private DateTime _birthday; public string Birthday { get => _birthday.Date.ToString("dd/MM/yyyy"); set => _birthday = DateTime.ParseExact(value, "dd/MM/yyyy", CultureInfo.CurrentCulture); }

Kazem
how about this ? testing.. private DateTim...

Seems like your library is making you jump through hoops just to accommodate it. My opinion is that it would be less painful to just find a proper DateTime input library.

Kazem- Автор вопроса
pete
Seems like your library is making you jump through...

Couldnt find a simple one also bootstrap datetime isnt working (styles not applying)

Kazem- Автор вопроса

Похожие вопросы

Обсуждают сегодня

А чем вам питонисты не угодили?😂
.
79
or any website to buy prepaid card with xmr that's not trocador that's down?
Umbrella Party Partner
18
Всем привет, написал код ниже, но он выдает сегфолт, в чем причина? #include <stdio.h> #include <stdlib.h> #include <string.h> struct product { char *name; float price; };...
buzz базз
75
Hi, I can't understand promises in JavaScript and what we should use them for (maybe the teacher didn't teach well XD). Do you have a solution for this? And are promises used...
A
29
Ещё такой вопрос. Мне необходимо хранить пароль пользователя локально. Для этого планирую использовать ini файл. Это для автозаполнения полей логин и пароль при авторизации. Е...
Евгений
19
всем доброго времени суток! имею вопрос: как понять ТОЧНО, что на нексус производится атака или он перегружен? исходные данные: - Nexus OSS 3.67.1-01 на OrientDB - Total co...
Michael Kostelcev
2
Ты просто гитлеровскую эстетику плохо понимаешь. Он же всё под Цезаря делал. А это как бы запрещённый приём в политике. Пиджаки они зачем все носят? Чтобы показать что они тип...
Ivan Kropotkin
4
Xem delist ho rha hai agr naa bhechu toh kya hoga after 1 july?
ABHI
27
i need usdt exchanged to xmr without kyc any site there ?
Certained
12
Did you guys see the latest tweet from TonGifts? 🚀
Mike
44
Карта сайта