Class DateTimePicker
Lets users input a date, a time, or both a date and a time.
Supports form submission validation. When Action.all_widgets_are_required
is set to true or this widget is specified in Action.required_widgets,
the submission action is blocked unless a value is selected. For an example
in Google Chat apps, see Let a user pick a date and
time.
Users can input text or use the picker to select dates and times. If users input an invalid date or time, the picker shows an error that prompts users to input the information correctly.
Implements
Namespace: Google.Apps.Card.V1
Assembly: Google.Apps.Card.V1.dll
Syntax
public sealed class DateTimePicker : IMessage<DateTimePicker>, IEquatable<DateTimePicker>, IDeepCloneable<DateTimePicker>, IBufferMessage, IMessage
Constructors
DateTimePicker()
Declaration
public DateTimePicker()
DateTimePicker(DateTimePicker)
Declaration
public DateTimePicker(DateTimePicker other)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTimePicker | other |
Properties
HasValueMsEpoch
Gets whether the "value_ms_epoch" field is set
Declaration
public bool HasValueMsEpoch { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Label
The text that prompts users to input a date, a time, or a date and time.
For example, if users are scheduling an appointment, use a label such as
Appointment date or Appointment date and time.
Declaration
public string Label { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Name
The name by which the DateTimePicker is identified in a form input event.
For details about working with form inputs, see Receive form data.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
OnChangeAction
Triggered when the user clicks Save or Clear from the
DateTimePicker interface.
Declaration
public Action OnChangeAction { get; set; }
Property Value
| Type | Description |
|---|---|
| Action |
TimezoneOffsetDate
The number representing the time zone offset from UTC, in minutes.
If set, the value_ms_epoch is displayed in the specified time zone.
If unset, the value defaults to the user's time zone setting.
Declaration
public int TimezoneOffsetDate { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Type
Whether the widget supports inputting a date, a time, or the date and time.
Declaration
public DateTimePicker.Types.DateTimePickerType Type { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTimePicker.Types.DateTimePickerType |
ValueMsEpoch
Optional. The default value displayed in the widget, in milliseconds since Unix epoch time.
Specify the value based on the type of picker (DateTimePickerType):
DATE_AND_TIME: a calendar date and time in UTC. For example, to represent January 1, 2023 at 12:00 PM UTC, use1672574400000.DATE_ONLY: a calendar date at 00:00:00 UTC. For example, to represent January 1, 2023, use1672531200000.TIME_ONLY: a time in UTC. For example, to represent 12:00 PM, use43200000(or12 * 60 * 60 * 1000).
Declaration
public long ValueMsEpoch { get; set; }
Property Value
| Type | Description |
|---|---|
| long |