I'm trying to take "Meeting data" as input from users.
I have a modal like this:
div class="simple-form">
<EditForm Model="meeting" OnValidSubmit="SubmitForm">
<DataAnnotationsValidator />
<div class="form-group">
<label>Location</label>
<InputText @bind-Value="meeting.Location" class="form-control" placeholder="Adres Giriniz" />
<ValidationMessage For="@(() => meeting.Location)" />
</div>
<div class="form-group">
<label>Date</label>
<InputDate @bind-Value="meeting.Date" />
<ValidationMessage For="@(() => meeting.Date)" />
</div>
<button type="submit" class="btn btn-primary">Submit</button>
<button @onclick="Cancel" class="btn btn-secondary">Cancel</button>
</EditForm>
</div>
@code {
Meetings meeting = new Meetings();
...
and this model return meeting object to main page where I Post it to database:
Meetings meeting;
async Task ShowModal()
{
var MeetingModal = Modal.Show<MeetingRequestComponent>();
var result = await MeetingModal.Result;
if (!result.Cancelled)
{
meeting = (Meetings)result.Data;
meeting.ReceiverId = id;
meeting.SenderId = _userId;
await http.PostAsJsonAsync("api/Meetings", meeting);
}
}
Model for Date info is just DateTime :
public DateTime Date { get; set; }
But I couldn't get the time information.
I tried to use
<input type="datetime" bind="meeting.Date">but it did not work. I couldn't take both Date and Time value. It discarded given time value and set as 12:00:00 AMI tried to create another column in the database for Hour and Minutes Data only but it asks for
bytes[].
Date Picker like this and time picker ("HH:mm")
How can I take time information as input?
How do I set an initial value to a date? (This was problematic because I get some error saying that I cannot use Value with @bind-Value)

meeting.Datewhen you create the value, e.g.Meetings meeting = new Meetings() { Date = DateTime.Today };