Class TimePicker
Stay organized with collections
Save and categorize content based on your preferences.
TimePicker
An input field that allows users to input a time.
Available for Google Workspace Add-ons and Google Chat apps.
var dateTimePicker = CardService.newTimePicker()
.setTitle("Enter the time.")
.setFieldName("time_field")
// Set default value as 3:30 AM.
.setHours(3)
.setMinutes(30)
.setOnChangeAction(CardService.newAction()
.setFunctionName("handleDateTimeChange"));
Detailed documentation
setFieldName(fieldName)
Sets the field name that identifies this picker in the event object that is generated when
there is a UI interaction. The field name is visible to the user. Required; the specified field
name must be unique.
Parameters
Name
| Type
| Description
|
fieldName
| String
| The name to assign to this input.
|
Return
TimePicker
— This picker, for chaining.
setHours(hours)
Sets the prefilled hours value to set in the input field.
Parameters
Name
| Type
| Description
|
hours
| Integer
| The default hour value placed in the input, range from 0 to 23. It is always
represented as a string in the form callback parameters.
|
Return
TimePicker
— This picker, for chaining.
setMinutes(minutes)
Sets the prefilled minutes value to set in the input field.
Parameters
Name
| Type
| Description
|
minutes
| Integer
| The default minutes value placed in the input, range from 0 to 59. It is always
represented as a string in the form callback parameters.
|
Return
TimePicker
— This picker, for chaining.
setOnChangeAction(action)
Sets an
Action
that the script performs whenever the picker input changes.
Parameters
Name
| Type
| Description
|
action
| Action
| The action to take.
|
Return
TimePicker
— This picker, for chaining.
setTitle(title)
Sets the title displayed above the input field.
Parameters
Name
| Type
| Description
|
title
| String
| The input field title.
|
Return
TimePicker
— This picker, for chaining.
Except as otherwise noted, the content of this page is licensed under the
Creative Commons Attribution 4.0 License
, and code samples are licensed under the
Apache 2.0 License
. For details, see the
Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-02-15 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]