Date and Time
Date
Confinity's Entity App supports DateTime and DateTimeOffset for inputting dates, times and both together.
Use the AddDateAndTime method to configure a input.
private void EventFormConfig(IFormLayoutBuilder<Event> form)
{
form.AddTab(tab =>
{
tab.AddDateAndTime(e => e.EventStart);
});
}
Not all types are supported or recommended for DateTime and DateTimeOffset, see below for details.
| Type | DateTime | DateTimeOffset |
|---|---|---|
| Date | ✔ | ❌ |
| Time | ✔ | ❌ |
| DateTimeLocal | ⁎ | ✔ |
⁎ For saving a point in time it is recommended to use DateTimeOffset to ensure correct handling in different timezones.
DateOnly / TimeOnly
Use DateOnly and TimeOnly when when not the whole Date is used.
private void EventFormConfig(IFormLayoutBuilder<Pet> form)
{
form.AddTab(tab =>
{
tab.AddDateOnly(p => p.DateOfBirth);
tab.AddTimeOnly(p => p.WakesUpAt);
});
}