Created
July 18, 2022 09:09
-
-
Save vnbaaij/0638c9a55d62b74c355ae5692cf303cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>Selected dates</h2> | |
<p> | |
<FluentCalendar DisabledDates=@disabledDates @bind-SelectedDates =@selectedDates></FluentCalendar> | |
</p> | |
<p>Dates Selected:</p> | |
<ul> | |
@foreach(DateOnly date in selectedDates) | |
{ | |
<li>@date.ToString("yyyy-MM-dd")</li> | |
} | |
</ul> | |
@code { | |
static int currentYear = DateTime.Now.Year; | |
static int currentMonth = DateTime.Now.Month; | |
static int daysInMonth = DateTime.DaysInMonth(currentYear, currentMonth) + 1; | |
static Random random = new(); | |
List<DateOnly> disabledDates = new(); | |
List<DateOnly> selectedDates = new(); | |
protected override void OnInitialized() | |
{ | |
for (int i = 0; i < 3; i++) | |
{ | |
disabledDates.Add(new DateOnly(currentYear, currentMonth, random.Next(1, daysInMonth))); | |
selectedDates.Add(new DateOnly(currentYear, currentMonth, random.Next(1, daysInMonth))); | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment