Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ExampleCard ComponentName="DateTimePicker" ExampleName="DateTimePickerExample1" Title="Usage" Description="MudDateTimePicker handles date and time selection itself.">
<DateTimePickerExample1 />
</ExampleCard>
<ExampleCard ComponentName="DateTimePicker" ExampleName="DateTimePickerExample2" Title="Generic Types" Description="MudDateTimePicker supports DateTime and DateTimeOffset.">
<ExampleCard ComponentName="DateTimePicker" ExampleName="DateTimePickerExample2" Title="Generic Types" Description="MudDateTimePicker supports DateTime, DateTimeOffset and DateOnly.">
<DateTimePickerExample2 />
</ExampleCard>
<ExampleCard ComponentName="DateTimePicker" ExampleName="DateTimePickerExample3" Title="Action Buttons" Description="Submit strategy can be handled via Action Buttons and AutoClose parameter.">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,25 @@

<MudGrid>
<MudItem xs="12" sm="8">
<MudDateTimePicker @bind-Value="_date" Editable="_editable" Label="DateTime" Clearable="_clearable" Variant="Variant.Outlined" Color="Color.Primary" />
<MudDateTimePicker @bind-Value="_date2" Editable="_editable" Label="DateTimeOffset" Clearable="_clearable" Variant="Variant.Outlined" Color="Color.Primary" />
<MudDateTimePicker @bind-Value="_date2" Editable="_editable" Label="TimeZone Istanbul" Clearable="_clearable" Variant="Variant.Outlined" Color="Color.Primary"
TimeZone="@TimeZoneInfo.FindSystemTimeZoneById("Europe/Istanbul")" />
<MudDateTimePicker @bind-Value="_date3" Editable="_editable" Label="DateOnly" Clearable="_clearable" Variant="Variant.Outlined" Color="Color.Primary" />
<MudStack Spacing="2">
<MudDateTimePicker @bind-Value="_dateTime" Editable="_editable"
Label="DateTime" Clearable="_clearable" Variant="Variant.Outlined" Color="Color.Primary" />
<MudDateTimePicker @bind-Value="_nullableDateTime" Editable="_editable" Label="DateTime?"
Clearable="_clearable" Variant="Variant.Outlined" Color="Color.Primary" />

<MudDateTimePicker @bind-Value="_dateTimeOffset" Editable="_editable" Label="DateTimeOffset"
Clearable="_clearable" Variant="Variant.Outlined" Color="Color.Primary" />
<MudDateTimePicker @bind-Value="_nullableDateTimeOffset" Editable="_editable" Label="DateTimeOffset?" Clearable="_clearable" Variant="Variant.Outlined"
Color="Color.Primary" />
<MudDateTimePicker @bind-Value="_istanbulDateTimeOffset" Editable="_editable" Label="TimeZone Istanbul"
Clearable="_clearable" Variant="Variant.Outlined" Color="Color.Primary"
TimeZone="@IstanbulTimeZone" />

<MudDateTimePicker @bind-Value="_dateOnly" Editable="_editable" Label="DateOnly" Clearable="_clearable" Variant="Variant.Outlined"
Color="Color.Primary" />
<MudDateTimePicker @bind-Value="_nullableDateOnly" Editable="_editable" Label="DateOnly?"
Clearable="_clearable" Variant="Variant.Outlined" Color="Color.Primary" />
</MudStack>
</MudItem>

<MudItem xs="12" sm="4">
Expand All @@ -19,9 +33,14 @@
</MudGrid>

@code {
private DateTime? _date = DateTime.Now;
private DateTimeOffset _date2 = DateTimeOffset.UtcNow;
private DateOnly _date3 = DateOnly.FromDateTime(DateTime.Now);
private static readonly TimeZoneInfo IstanbulTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Europe/Istanbul");
private DateTime _dateTime = DateTime.Now;
private DateTime? _nullableDateTime;
private DateTimeOffset _dateTimeOffset = DateTimeOffset.UtcNow;
private DateTimeOffset _istanbulDateTimeOffset = TimeZoneInfo.ConvertTime(DateTimeOffset.UtcNow, IstanbulTimeZone);
private DateTimeOffset? _nullableDateTimeOffset;
private DateOnly _dateOnly = DateOnly.FromDateTime(DateTime.Now);
private DateOnly? _nullableDateOnly;
private bool _clearable = false;
private bool _editable = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,61 @@

<MudGrid>
<MudItem xs="12" sm="8">
<MudDateTimePicker @ref="_picker" @bind-Value="_date" Editable="_editable" Label="Date" Clearable="_clearable"
ShowToolbar="_showToolbar" Variant="_variant" Color="_color" DateFormat="@_dateFormat">
<PickerActions>
<MudButton Class="mr-auto align-self-start" OnClick="@(() => _picker.ClearAsync())">Clear</MudButton>
<MudButton OnClick="@(() => _picker.CloseAsync(false))">Cancel</MudButton>
<MudButton Color="Color.Primary" OnClick="@(() => _picker.CloseAsync())">OK</MudButton>
</PickerActions>
</MudDateTimePicker>
<MudStack Spacing="2">
<MudDateTimePicker @ref="_dateTimePicker" @bind-Value="_dateTime" Editable="_editable" Label="DateTime" Clearable="_clearable"
ShowToolbar="_showToolbar" Variant="_variant" Color="_color" DateFormat="@_dateFormat">
<PickerActions>
<MudButton Class="mr-auto align-self-start" OnClick="@(() => _dateTimePicker.ClearAsync())">Clear</MudButton>
<MudButton OnClick="@(() => _dateTimePicker.CloseAsync(false))">Cancel</MudButton>
<MudButton Color="Color.Primary" OnClick="@(() => _dateTimePicker.CloseAsync())">OK</MudButton>
</PickerActions>
</MudDateTimePicker>

<MudDateTimePicker @ref="_nullableDateTimePicker" @bind-Value="_nullableDateTime" Editable="_editable" Label="DateTime?" Clearable="_clearable"
ShowToolbar="_showToolbar" Variant="_variant" Color="_color" DateFormat="@_dateFormat">
<PickerActions>
<MudButton Class="mr-auto align-self-start" OnClick="@(() => _nullableDateTimePicker.ClearAsync())">Clear</MudButton>
<MudButton OnClick="@(() => _nullableDateTimePicker.CloseAsync(false))">Cancel</MudButton>
<MudButton Color="Color.Primary" OnClick="@(() => _nullableDateTimePicker.CloseAsync())">OK</MudButton>
</PickerActions>
</MudDateTimePicker>

<MudDateTimePicker @ref="_dateTimeOffsetPicker" @bind-Value="_dateTimeOffset" Editable="_editable" Label="DateTimeOffset" Clearable="_clearable"
ShowToolbar="_showToolbar" Variant="_variant" Color="_color" DateFormat="@_dateFormat">
<PickerActions>
<MudButton Class="mr-auto align-self-start" OnClick="@(() => _dateTimeOffsetPicker.ClearAsync())">Clear</MudButton>
<MudButton OnClick="@(() => _dateTimeOffsetPicker.CloseAsync(false))">Cancel</MudButton>
<MudButton Color="Color.Primary" OnClick="@(() => _dateTimeOffsetPicker.CloseAsync())">OK</MudButton>
</PickerActions>
</MudDateTimePicker>

<MudDateTimePicker @ref="_nullableDateTimeOffsetPicker" @bind-Value="_nullableDateTimeOffset" Editable="_editable" Label="DateTimeOffset?" Clearable="_clearable"
ShowToolbar="_showToolbar" Variant="_variant" Color="_color" DateFormat="@_dateFormat">
<PickerActions>
<MudButton Class="mr-auto align-self-start" OnClick="@(() => _nullableDateTimeOffsetPicker.ClearAsync())">Clear</MudButton>
<MudButton OnClick="@(() => _nullableDateTimeOffsetPicker.CloseAsync(false))">Cancel</MudButton>
<MudButton Color="Color.Primary" OnClick="@(() => _nullableDateTimeOffsetPicker.CloseAsync())">OK</MudButton>
</PickerActions>
</MudDateTimePicker>

<MudDateTimePicker @ref="_dateOnlyPicker" @bind-Value="_dateOnly" Editable="_editable" Label="DateOnly" Clearable="_clearable"
ShowToolbar="_showToolbar" Variant="_variant" Color="_color" DateFormat="@_dateFormat">
<PickerActions>
<MudButton Class="mr-auto align-self-start" OnClick="@(() => _dateOnlyPicker.ClearAsync())">Clear</MudButton>
<MudButton OnClick="@(() => _dateOnlyPicker.CloseAsync(false))">Cancel</MudButton>
<MudButton Color="Color.Primary" OnClick="@(() => _dateOnlyPicker.CloseAsync())">OK</MudButton>
</PickerActions>
</MudDateTimePicker>

<MudDateTimePicker @ref="_nullableDateOnlyPicker" @bind-Value="_nullableDateOnly" Editable="_editable" Label="DateOnly?" Clearable="_clearable"
ShowToolbar="_showToolbar" Variant="_variant" Color="_color" DateFormat="@_dateFormat">
<PickerActions>
<MudButton Class="mr-auto align-self-start" OnClick="@(() => _nullableDateOnlyPicker.ClearAsync())">Clear</MudButton>
<MudButton OnClick="@(() => _nullableDateOnlyPicker.CloseAsync(false))">Cancel</MudButton>
<MudButton Color="Color.Primary" OnClick="@(() => _nullableDateOnlyPicker.CloseAsync())">OK</MudButton>
</PickerActions>
</MudDateTimePicker>
</MudStack>
</MudItem>

<MudItem xs="12" sm="4">
Expand All @@ -32,15 +79,25 @@
}
</MudSelect>
<MudTextField @bind-Value="_dateFormat" Variant="Variant.Outlined" Label="Date Format" />
<MudButton OnClick="@(() => _date = DateTime.Now)">Set Today</MudButton>
<MudButton OnClick="SetCurrentValues">Set Current Values</MudButton>
</MudStack>
</MudItem>
</MudGrid>

@code {
private MudDateTimePicker<DateTime?> _picker = null!;
private MudDateTimePicker<DateTime> _dateTimePicker = null!;
private MudDateTimePicker<DateTime?> _nullableDateTimePicker = null!;
private MudDateTimePicker<DateTimeOffset> _dateTimeOffsetPicker = null!;
private MudDateTimePicker<DateTimeOffset?> _nullableDateTimeOffsetPicker = null!;
private MudDateTimePicker<DateOnly> _dateOnlyPicker = null!;
private MudDateTimePicker<DateOnly?> _nullableDateOnlyPicker = null!;

private DateTime? _date = DateTime.Now;
private DateTime _dateTime = DateTime.Now;
private DateTime? _nullableDateTime;
private DateTimeOffset _dateTimeOffset = DateTimeOffset.UtcNow;
private DateTimeOffset? _nullableDateTimeOffset;
private DateOnly _dateOnly = DateOnly.FromDateTime(DateTime.Now);
private DateOnly? _nullableDateOnly;
private bool _editable = false;
private bool _showToolbar = true;
private bool _submitOnClose = true;
Expand All @@ -49,4 +106,16 @@
private bool _isAdornmentEnd = true;
private bool _clearable = false;
private Variant _variant = Variant.Outlined;

private void SetCurrentValues()
{
_dateTime = DateTime.Now;
_nullableDateTime = DateTime.Now;
_dateTimeOffset = DateTimeOffset.UtcNow;
_nullableDateTimeOffset = DateTimeOffset.UtcNow;
_dateOnly = DateOnly.FromDateTime(DateTime.Now);
_nullableDateOnly = DateOnly.FromDateTime(DateTime.Now);
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<_Parameter1>CodeBeam.MudBlazor.Extensions.UnitTests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

<ItemGroup>
<None Include="Mud_Secondary.png">
<Pack>True</Pack>
Expand Down
Loading