Fixed Selected Date

This commit is contained in:
Robin Weichselbraun 2024-10-21 15:36:52 +02:00
parent 6e317713b3
commit f6e38d3beb
3 changed files with 13 additions and 4 deletions

View File

@ -19,7 +19,7 @@ namespace UWLecturePlan.Controllers
var from = DateTime.Now;
var date = DateTime.ParseExact(model.Date, "dd.MM.yyyy", CultureInfo.InvariantCulture);
var date = DateTime.ParseExact(model.Date, "dd.MM.yyyy", CultureInfo.GetCultureInfo("de"));
model.LectureEvents = [.. db.LectureEvents.Include(x=>x.Lecture)

View File

@ -39,10 +39,19 @@
<select asp-for="Date" class="form-select">
@foreach (var day in Model.Days)
{
<option value="@day.Key.ToShortDateString()">
@day.Key.ToString("dd.MM.yyyy") - @day.Value
if (@day.Key.ToString("dd.MM.yyyy") == Model.Date)
{
<option value="@day.Key.ToString("dd.MM.yyyy")" selected>
@day.Key.ToString("ddd dd.MM.yyyy") - @day.Value
</option>
}
else
{
<option value="@day.Key.ToString("dd.MM.yyyy")">
@day.Key.ToString("ddd dd.MM.yyyy") - @day.Value
</option>
}
}
</select>
</div>
<div class="order-1 col-12 col-sm-6 col-md-7 col-lg-3 col-xxl-2">

Binary file not shown.