Mit Sammlungen den Überblick behalten Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Datumsauswahl
Ein Eingabefeld, in das ein Datum eingegeben werden kann.
Verfügbar für Google Workspace-Add-ons und Google Chat-Apps.
constdateTimePicker=CardService.newDatePicker().setTitle('Enter the date.').setFieldName('date_field')// Set default value as Jan 1, 2018 UTC. Either a number or string is// acceptable..setValueInMsSinceEpoch(1514775600).setOnChangeAction(CardService.newAction().setFunctionName('handleDateTimeChange'),);
Legt den vorausgefüllten Wert fest, der im Eingabefeld festgelegt werden soll.
Detaillierte Dokumentation
setFieldName(fieldName)
Legt den Feldnamen fest, der diese Auswahl im Ereignisobjekt identifiziert, das generiert wird, wenn eine UI-Interaktion stattfindet. Der Feldname ist für den Nutzer sichtbar. Erforderlich. Der angegebene Feldname muss eindeutig sein.
Parameter
Name
Typ
Beschreibung
fieldName
String
Der Name, der dieser Eingabe zugewiesen werden soll.
Legt den vorausgefüllten Wert fest, der im Eingabefeld festgelegt werden soll.
Parameter
Name
Typ
Beschreibung
valueMsEpoch
Number
Der Standardwert, der als Zahl in Millisekunden seit der Epoche in die Eingabe eingefügt wird. Es wird nur das Datum der Epochenzeit verwendet. Die Uhrzeit wird verworfen. Sie wird in den Rückrufparametern des Formulars immer als String dargestellt.
Legt den vorausgefüllten Wert fest, der im Eingabefeld festgelegt werden soll.
Parameter
Name
Typ
Beschreibung
valueMsEpoch
String
Der Standardwert, der als String in die Eingabe eingefügt wird, in Millisekunden seit der Epoche. Es wird nur das Datum der Epochenzeit verwendet. Die Uhrzeit wird verworfen. Sie wird in den Rückrufparametern des Formulars immer als String dargestellt.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-07-26 (UTC)."],[[["\u003cp\u003eThe \u003ccode\u003eDatePicker\u003c/code\u003e is an input field allowing users to select a date, available for use in Google Workspace Add-ons and Google Chat apps.\u003c/p\u003e\n"],["\u003cp\u003eIt offers methods to set a field name for event handling, trigger actions on input changes, provide a title for clarity, and pre-fill a default date value.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003esetValueInMsSinceEpoch\u003c/code\u003e method accepts either a number or a string representing milliseconds since the epoch to set the default date.\u003c/p\u003e\n"],["\u003cp\u003eAll configuration methods for the \u003ccode\u003eDatePicker\u003c/code\u003e are chainable, allowing for concise and readable code when setting multiple properties.\u003c/p\u003e\n"]]],["The `DatePicker` component, available for Google Workspace add-ons and Google Chat apps, creates a date input field. Key actions include setting the `fieldName` to identify the picker in UI interactions, defining an `onChangeAction` for script execution upon input changes, and setting a `title` for the field. You can also set a default `valueInMsSinceEpoch` as a number or string. Each method returns the `DatePicker` object, enabling method chaining.\n"],null,["DatePicker\n\nAn input field that allows inputing a date.\n\nAvailable for Google Workspace add-ons and Google Chat apps.\n\n```javascript\nconst dateTimePicker =\n CardService.newDatePicker()\n .setTitle('Enter the date.')\n .setFieldName('date_field')\n // Set default value as Jan 1, 2018 UTC. Either a number or string is\n // acceptable.\n .setValueInMsSinceEpoch(1514775600)\n .setOnChangeAction(\n CardService.newAction().setFunctionName('handleDateTimeChange'),\n );\n``` \n\nMethods\n\n| Method | Return type | Brief description |\n|-------------------------------------------------------------------------|-----------------|--------------------------------------------------------------------------------------------------------------------------|\n| [setFieldName(fieldName)](#setFieldName(String)) | [DatePicker](#) | Sets the field name that identifies this picker in the event object that is generated when there is a UI interaction. |\n| [setOnChangeAction(action)](#setOnChangeAction(Action)) | [DatePicker](#) | Sets an [Action](/apps-script/reference/card-service/action) that the script performs whenever the picker input changes. |\n| [setTitle(title)](#setTitle(String)) | [DatePicker](#) | Sets the title displayed above the input field. |\n| [setValueInMsSinceEpoch(valueMsEpoch)](#setValueInMsSinceEpoch(Number)) | [DatePicker](#) | Sets the prefilled value to be set in the input field. |\n| [setValueInMsSinceEpoch(valueMsEpoch)](#setValueInMsSinceEpoch(String)) | [DatePicker](#) | Sets the prefilled value to be set in the input field. |\n\nDetailed documentation \n\n`set``Field``Name(fieldName)` \nSets the field name that identifies this picker in the event object that is generated when\nthere is a UI interaction. The field name is visible to the user. Required; the specified field\nname must be unique.\n\nParameters\n\n| Name | Type | Description |\n|---------------|----------|-----------------------------------|\n| `field``Name` | `String` | The name to assign to this input. |\n\nReturn\n\n\n[DatePicker](#) --- This picker, for chaining.\n\n*** ** * ** ***\n\n`set``On``Change``Action(action)` \nSets an [Action](/apps-script/reference/card-service/action) that the script performs whenever the picker input changes.\n\nParameters\n\n| Name | Type | Description |\n|----------|------------------------------------------------------|---------------------|\n| `action` | [Action](/apps-script/reference/card-service/action) | The action to take. |\n\nReturn\n\n\n[DatePicker](#) --- This picker, for chaining.\n\n*** ** * ** ***\n\n`set``Title(title)` \nSets the title displayed above the input field.\n\nParameters\n\n| Name | Type | Description |\n|---------|----------|------------------------|\n| `title` | `String` | The input field title. |\n\nReturn\n\n\n[DatePicker](#) --- This picker, for chaining.\n\n*** ** * ** ***\n\n`set``Value``In``Ms``Since``Epoch(valueMsEpoch)` \nSets the prefilled value to be set in the input field.\n\nParameters\n\n| Name | Type | Description |\n|--------------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `value``Ms``Epoch` | `Number` | The default value placed in the input as a number, in milliseconds since the epoch. Only the date of the epoch time is used, and the time of the epoch time is discarded. It is always represented as a string in the form callback parameters. |\n\nReturn\n\n\n[DatePicker](#) --- This picker, for chaining.\n\n*** ** * ** ***\n\n`set``Value``In``Ms``Since``Epoch(valueMsEpoch)` \nSets the prefilled value to be set in the input field.\n\nParameters\n\n| Name | Type | Description |\n|--------------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `value``Ms``Epoch` | `String` | The default value placed in the input as a string, in milliseconds since the epoch. Only the date of the epoch time is used, and the time of the epoch time is discarded. It is always represented as a string in the form callback parameters. |\n\nReturn\n\n\n[DatePicker](#) --- This picker, for chaining."]]