Date
Local date or date and time input with a calendar, display mask, and validation.
Quick start
Add Date1 in the Designer. Use the example in a page method.
Date1.mode = 'date';
Date1.dateFormat = 'dd/MM/yyyy';
Date1.required = true;
Date1.min = '2026-01-01';
Date1.max = '2026-12-31';
Date1.value = '2026-11-04';
Date1.onChange = (sender) => {
if (sender.valid) console.log(sender.value, sender.text);
};Configure a date field
- Add Date from the palette and select it in the Designer.
- In the Inspector, choose Mode: date or datetime. Set Date format to dd/MM/yyyy, MM/dd/yyyy, or yyyy-MM-dd; enable Show seconds for datetime when needed.
- Set the accessible label, optional placeholder, required and read-only settings, and whether to show the calendar. Configure value, min, and max using local ISO values; the limits are inclusive.
- Link OnInput for typing and OnChange for a committed change in Interaction. The calendar can also be opened with Alt+Down or showPicker().
Values and validation
The displayed mask follows the selected format and mode. value uses YYYY-MM-DD or local YYYY-MM-DDTHH:mm[:ss], independent of the display format. These are local calendar fields with no time zone or UTC conversion. text contains the displayed draft, including incomplete or impossible dates; value is empty for such drafts. date returns a local Date at the start of the day, while datetime includes the time; both return null for invalid or incomplete input.
Use valid or checkValidity() before processing input and reportValidity() to show the browser's validation message. required, min, and max participate in validation. clear() clears the field and setNow() uses the current local date and time. Runtime assignments affect the current instance; configure the Inspector to save project defaults.
More examples
Date and time with validation
Date1.mode = 'datetime';
Date1.dateFormat = 'MM/dd/yyyy';
Date1.showSeconds = true;
Date1.min = '2026-01-01T09:00:00';
Date1.max = '2026-12-31T18:00:00';
Date1.value = '2026-11-04T14:30:00';
if (Date1.reportValidity()) {
console.log(Date1.value, Date1.text, Date1.datetime);
}Calendar and current date
Date1.mode = 'date';
Date1.setNow();
if (!Date1.showPicker()) console.log('Calendar is unavailable');
// Date1.clear();Inspector properties
Component options and defaults. Fields without runtime access are configured in the Inspector.
| Property / source | Type and options | Default | Runtime access |
|---|---|---|---|
nameName · Identity | string | — | name |
xLeft · Size & position | number | 0 | x |
yTop · Size & position | number | 0 | y |
widthWidth · Size & position | number | 240 | width |
heightHeight · Size & position | number | 36 | height |
itemWidthResponsive width · Responsive sizeFit content grows the item to its widest rendered child and preserves child intrinsic widths; minimum and maximum width remain limits. | enumfixed stretch fit-content | "fixed" | Inspector / configuration |
itemHeightResponsive height · Responsive sizeFit content grows the item to its lowest rendered child and preserves child intrinsic heights; minimum and maximum height remain limits. | enumfixed stretch fit-content | "fixed" | Inspector / configuration |
itemMinWidthMinimum width · Responsive size | number | 0 | Inspector / configuration |
itemMaxWidthMaximum width · Responsive size | number | null | Inspector / configuration |
itemMinHeightMinimum height · Responsive size | number | 0 | Inspector / configuration |
itemMaxHeightMaximum height · Responsive size | number | null | Inspector / configuration |
itemGrowGrow · Responsive size | number | 0 | Inspector / configuration |
itemShrinkShrink · Responsive sizeAllows fixed and stretch flow items to yield space. Fit-content keeps its intrinsic size so its children are not compressed. | boolean | true | Inspector / configuration |
itemAlignSelfItem alignment · Responsive sizeCross-axis alignment for this item in a row or column. Auto inherits the parent alignment; responsive cross-axis stretch retains its sizing behavior. | enumauto start center end stretch | "auto" | Inspector / configuration |
itemHorizontalAnchorHorizontal anchor · Anchors & offsets | enumstart center end stretch | "start" | Inspector / configuration |
itemVerticalAnchorVertical anchor · Anchors & offsets | enumstart center end stretch | "start" | Inspector / configuration |
itemLeftLeft inset · Anchors & offsets | number | 0 | Inspector / configuration |
itemRightRight inset · Anchors & offsets | number | 0 | Inspector / configuration |
itemTopTop inset · Anchors & offsets | number | 0 | Inspector / configuration |
itemBottomBottom inset · Anchors & offsets | number | 0 | Inspector / configuration |
marginMargin · SpacingOuter spacing on all four sides, in pixels. Row and column layouts include this spacing between components. | number | 0 | margin |
marginTopMargin top · SpacingOuter spacing on this side, in pixels. Overrides the shared Margin value. | number | 0Derived from saved properties | marginTop |
marginRightMargin right · SpacingOuter spacing on this side, in pixels. Overrides the shared Margin value. | number | 0Derived from saved properties | marginRight |
marginBottomMargin bottom · SpacingOuter spacing on this side, in pixels. Overrides the shared Margin value. | number | 0Derived from saved properties | marginBottom |
marginLeftMargin left · SpacingOuter spacing on this side, in pixels. Overrides the shared Margin value. | number | 0Derived from saved properties | marginLeft |
visibleVisible · Behavior | boolean | true | visible |
enabledEnabled · Behavior | boolean | true | enabled |
tabIndexTabIndex · Behavior | number | 0 | tabIndex |
modeMode · Date & timeDate only, or a local date and time without automatic UTC conversion. | enumdate datetime | "date" | mode |
dateFormatDate format · Date & timeDisplay and typing mask. The canonical value always uses ISO calendar fields. | enumdd/MM/yyyy MM/dd/yyyy yyyy-MM-dd | "dd/MM/yyyy" | dateFormat |
showSecondsShow seconds · Date & time | boolean | false | showSecondsConditional availability in the Inspector |
valueValue · DataEmpty, YYYY-MM-DD, or local YYYY-MM-DDTHH:mm[:ss]. The display uses the selected mask. | string | "" | value |
minMinimum · ValidationInclusive lower limit in local ISO format; empty removes the limit. | string | "" | min |
maxMaximum · ValidationInclusive upper limit in local ISO format; empty removes the limit. | string | "" | max |
requiredRequired · Validation | boolean | false | required |
readOnlyRead Only · Behavior | boolean | false | readOnly |
showCalendarShow calendar · Appearance | boolean | true | showCalendar |
placeholderPlaceholder · AppearanceEmpty displays the selected mask. | string | "" | placeholder |
accessibleLabelAccessible label · AccessibilityEmpty uses the component name. | string | "" | accessibleLabel |
currentRowBindingsCurrent row · DataBind writable visual values to fields of this repeated row. | current-row-bindingsEditor: current-row-bindings | [] | currentRowBindings |
API in code
| Member | Signature | Access |
|---|---|---|
mode | get mode(): WebDateMode; | Read and write |
dateFormat | get dateFormat(): WebDateFormat; | Read and write |
showSeconds | get showSeconds(): boolean; | Read and write |
mask | get mask(): string; | Read-only |
valueCanonical YYYY-MM-DD or YYYY-MM-DDTHH:mm[:ss]; empty while incomplete/invalid. | get value(): string; | Read and write |
textDisplay text, including an incomplete or invalid draft. | get text(): string; | Read and write |
dateA fresh Date at the start of the local day; null for an empty/incomplete/impossible date. | get date(): Date | null; | Read and write |
datetimeA fresh local Date including time; date mode returns the start of the local day. | get datetime(): Date | null; | Read and write |
min | get min(): string; | Read and write |
max | get max(): string; | Read and write |
required | get required(): boolean; | Read and write |
readOnly | get readOnly(): boolean; | Read and write |
placeholder | get placeholder(): string; | Read and write |
accessibleLabel | get accessibleLabel(): string; | Read and write |
showCalendar | get showCalendar(): boolean; | Read and write |
visible | get visible(): boolean; | Read and write |
enabled | get enabled(): boolean; | Read and write |
tabIndex | get tabIndex(): number; | Read and write |
valid | get valid(): boolean; | Read-only |
validationMessage | get validationMessage(): string; | Read-only |
onChange | set onChange(handler: WebComponentEventHandler<this> | null); | Read and write |
onInput | set onInput(handler: WebComponentEventHandler<this> | null); | Read and write |
focus
methodfocus(options?: FocusOptions): void;Example
Date1.focus({ preventScroll: true });checkValidity
methodcheckValidity(): boolean;Example
Date1.checkValidity();reportValidity
methodreportValidity(): boolean;Example
Date1.reportValidity();clear
methodclear(): void;Example
Date1.clear();setNow
methodsetNow(): void;Example
Date1.setNow();showPicker
methodshowPicker(): boolean;Opens the calendar aligned to the field, with a minimum popup width of 260px.
Example
Date1.showPicker();dispose
methoddispose(): void;Example
// Call only when disposing of an instance whose lifecycle you control.
Date1.dispose();Inherited members (22)
| Member | Signature | Access |
|---|---|---|
currentRowBindings | currentRowBindings: readonly WebCurrentRowBinding[]; | Read and write |
element | readonly element: TElement; | Read-only |
id | readonly id: string; | Read-only |
name | readonly name: string; | Read-only |
x | x: number; | Read and write |
y | y: number; | Read and write |
width | width: number; | Read and write |
height | height: number; | Read and write |
marginOuter spacing on all four sides, in pixels. | margin: number; | Read and write |
marginTop | marginTop: number; | Read and write |
marginRight | marginRight: number; | Read and write |
marginBottom | marginBottom: number; | Read and write |
marginLeft | marginLeft: number; | Read and write |
alignSelf | alignSelf: RuntimeLayoutAlignSelf; | Read and write |
backgroundColor | backgroundColor: string; | Read and write |
color | color: string; | Read and write |
borderColor | borderColor: string; | Read and write |
show
methodshow(): void;hide
methodhide(): void;bindEvent
methodbindEvent(eventName: string, handler: WebComponentEventHandler<this> | null): () => void;emit
methodemit(eventName: string, detail?: unknown): boolean;Events
Link methods in Interaction. How to use events.
OnChange
Standard event (Event).
Signature and example
import type { WebDate } from '@webrad/runtime';
// Copy this method into the page class and link it in Interaction.
class Example {
public async Date1Change(
sender: WebDate,
event: Event,
): Promise<void> {
console.log(sender.name, event.type);
}
}OnInput
Standard event (Event).
Signature and example
import type { WebDate } from '@webrad/runtime';
// Copy this method into the page class and link it in Interaction.
class Example {
public async Date1Input(
sender: WebDate,
event: Event,
): Promise<void> {
console.log(sender.name, event.type);
}
}OnFocus
Standard event (Event).
Signature and example
import type { WebDate } from '@webrad/runtime';
// Copy this method into the page class and link it in Interaction.
class Example {
public async Date1Focus(
sender: WebDate,
event: Event,
): Promise<void> {
console.log(sender.name, event.type);
}
}OnBlur
Standard event (Event).
Signature and example
import type { WebDate } from '@webrad/runtime';
// Copy this method into the page class and link it in Interaction.
class Example {
public async Date1Blur(
sender: WebDate,
event: Event,
): Promise<void> {
console.log(sender.name, event.type);
}
}OnKeyDown
Standard event (Event).
Signature and example
import type { WebDate } from '@webrad/runtime';
// Copy this method into the page class and link it in Interaction.
class Example {
public async Date1KeyDown(
sender: WebDate,
event: Event,
): Promise<void> {
if (event instanceof KeyboardEvent) console.log(event.key);
}
}OnKeyUp
Standard event (Event).
Signature and example
import type { WebDate } from '@webrad/runtime';
// Copy this method into the page class and link it in Interaction.
class Example {
public async Date1KeyUp(
sender: WebDate,
event: Event,
): Promise<void> {
if (event instanceof KeyboardEvent) console.log(event.key);
}
}