DateModal class
Namespace: Arlecchino.Modals.Setting · Assembly: Arlecchino
A calendar date, edited as year, month and day, and kept inside both the bounds and the calendar at every step. A day the new month does not have is pulled back to its last.
public sealed class DateModal : SegmentedModal
Inherits from SegmentedModal
Constructors
| Member | Summary |
|---|---|
DateModal() |
Properties
| Member | Summary |
|---|---|
Maximum | Latest date allowed. |
Minimum | Earliest date allowed. |
OnSubmit | Called with the date that was confirmed. |
SegmentCount | Year, month and day. |
Separator | Segments are drawn in ISO order, so they are separated by a dash. |
Value | The date as it stands. Defaults to today. |
Methods
| Member | Summary |
|---|---|
Add(int) | Steps by whole years, months or days depending on the active segment, so stepping the month at the end of a long month lands on a date the shorter month actually has. |
ApplyTypedValue(int, int) | Stores a typed segment, pulling impossible input into range: month into 1-12 and day into the days the resulting month has. |
Draw(ModalFrame) | |
SegmentLength(int) | Four digits for the year, two for the rest. |
SegmentTexts() | The date as a four-digit year and two-digit month and day. |
Submit() |
Constructors in detail
DateModal()
Constructors of types with required members are not supported in this version of your compiler.
public DateModal();
Properties in detail
Maximum
public DateOnly Maximum { get; init; }
Latest date allowed.
Type DateOnly
Minimum
public DateOnly Minimum { get; init; }
Earliest date allowed.
Type DateOnly
OnSubmit
public Action<DateOnly> OnSubmit { get; init; }
Called with the date that was confirmed.
Type Action<T><DateOnly>
SegmentCount
public virtual int SegmentCount { get; }
Year, month and day.
Type int
Separator
public override string Separator { get; }
Segments are drawn in ISO order, so they are separated by a dash.
Type string
Value
public DateOnly Value { get; set; }
The date as it stands. Defaults to today.
Type DateOnly
Methods in detail
Add(int)
public virtual void Add(int delta);
Steps by whole years, months or days depending on the active segment, so stepping the month at the end of a long month lands on a date the shorter month actually has.
Parameters
| Name | Type | Description |
|---|---|---|
delta | int | How far to step; negative goes back. |
ApplyTypedValue(int, int)
public virtual void ApplyTypedValue(int segment, int value);
Stores a typed segment, pulling impossible input into range: month into 1-12 and day into the days the resulting month has.
Parameters
| Name | Type | Description |
|---|---|---|
segment | int | Index of the segment that was typed into. |
value | int | The digits, parsed. |
Draw(ModalFrame)
public override void Draw(ModalFrame frame);
Parameters
| Name | Type | Description |
|---|---|---|
frame | ModalFrame |
SegmentLength(int)
public virtual int SegmentLength(int segment);
Four digits for the year, two for the rest.
Parameters
| Name | Type | Description |
|---|---|---|
segment | int | Index of the segment. |
Returns int — Its digit count.
SegmentTexts()
public virtual string[] SegmentTexts();
The date as a four-digit year and two-digit month and day.
Returns string[] — One string per segment.
Submit()
public virtual void Submit();