Class DatePicker
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
انتخابگر تاریخ یک فیلد ورودی که اجازه می دهد تاریخ را وارد کنید.
برای افزونههای Google Workspace و برنامههای Google Chat موجود است.
const dateTimePicker =
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'),
);
مستندات دقیق
set Field Name(fieldName)
نام فیلدی را تنظیم می کند که این انتخابگر را در شی رویدادی که در هنگام وجود تعامل رابط کاربری ایجاد می شود، مشخص می کند. نام فیلد برای کاربر قابل مشاهده است. مورد نیاز؛ نام فیلد مشخص شده باید منحصر به فرد باشد.
پارامترها
نام | تایپ کنید | توضیحات |
---|
field Name | String | نامی که باید به این ورودی اختصاص داده شود. |
بازگشت
Date Picker
- این جمع کننده، برای زنجیر زدن.
set On Change Action(action)
Action
تنظیم می کند که اسکریپت هر زمان که ورودی انتخابگر تغییر کند، انجام دهد.
پارامترها
نام | تایپ کنید | توضیحات |
---|
action | Action | اقدامی که باید انجام داد. |
بازگشت
Date Picker
- این جمع کننده، برای زنجیر زدن.
set Title(title)
عنوان نمایش داده شده در بالای فیلد ورودی را تنظیم می کند.
پارامترها
نام | تایپ کنید | توضیحات |
---|
title | String | عنوان فیلد ورودی |
بازگشت
Date Picker
- این جمع کننده، برای زنجیر زدن.
set Value In Ms Since Epoch(valueMsEpoch)
مقدار از پیش پر شده را برای تنظیم در قسمت ورودی تنظیم می کند.
پارامترها
نام | تایپ کنید | توضیحات |
---|
value Ms Epoch | Number | مقدار پیشفرض در ورودی بهعنوان یک عدد، بر حسب میلیثانیه از آن دوره قرار میگیرد. فقط از تاریخ زمان عصر استفاده می شود و زمان زمان دور انداخته می شود. همیشه به عنوان یک رشته در پارامترهای پاسخ به تماس نشان داده می شود. |
بازگشت
Date Picker
- این جمع کننده، برای زنجیر زدن.
set Value In Ms Since Epoch(valueMsEpoch)
مقدار از پیش پر شده را برای تنظیم در قسمت ورودی تنظیم می کند.
پارامترها
نام | تایپ کنید | توضیحات |
---|
value Ms Epoch | String | مقدار پیشفرض در ورودی بهعنوان یک رشته، بر حسب میلیثانیه از آن دوره قرار میگیرد. فقط از تاریخ زمان عصر استفاده می شود و زمان زمان دور انداخته می شود. همیشه به عنوان یک رشته در پارامترهای پاسخ به تماس نشان داده می شود. |
بازگشت
Date Picker
- این انتخابگر، برای زنجیر زدن.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\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,["# Class DatePicker\n\nDatePicker\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\n### Methods\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\n### `set``Field``Name(fieldName)`\n\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\n#### Parameters\n\n| Name | Type | Description |\n|---------------|----------|-----------------------------------|\n| `field``Name` | `String` | The name to assign to this input. |\n\n#### Return\n\n\n[DatePicker](#) --- This picker, for chaining.\n\n*** ** * ** ***\n\n### `set``On``Change``Action(action)`\n\nSets an [Action](/apps-script/reference/card-service/action) that the script performs whenever the picker input changes.\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|------------------------------------------------------|---------------------|\n| `action` | [Action](/apps-script/reference/card-service/action) | The action to take. |\n\n#### Return\n\n\n[DatePicker](#) --- This picker, for chaining.\n\n*** ** * ** ***\n\n### `set``Title(title)`\n\nSets the title displayed above the input field.\n\n#### Parameters\n\n| Name | Type | Description |\n|---------|----------|------------------------|\n| `title` | `String` | The input field title. |\n\n#### Return\n\n\n[DatePicker](#) --- This picker, for chaining.\n\n*** ** * ** ***\n\n### `set``Value``In``Ms``Since``Epoch(valueMsEpoch)`\n\nSets the prefilled value to be set in the input field.\n\n#### Parameters\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\n#### Return\n\n\n[DatePicker](#) --- This picker, for chaining.\n\n*** ** * ** ***\n\n### `set``Value``In``Ms``Since``Epoch(valueMsEpoch)`\n\nSets the prefilled value to be set in the input field.\n\n#### Parameters\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\n#### Return\n\n\n[DatePicker](#) --- This picker, for chaining."]]