Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,60 @@ Rendered input:

![Apify Actor input schema - country input](./images/input-schema-country.png)

Example of date selection using absolute and relative `datepicker` editor:

```json
{
"absolute_date": {
"title": "Date",
"type": "string",
"description": "Select date",
"editor": "datepicker"
},
"relative_date": {
"title": "Relative date",
"type": "string",
"description": "Select date",
"editor": "datepicker",
"allowAbsolute": false,
"allowRelative": true
},
"any_date": {
"title": "Any date",
"type": "string",
"description": "Select date",
"editor": "datepicker",
"allowRelative": true
}
}
```

The `absolute_date` property renders a date picker that allows selection of a specific date and returns string value in the format `YYYY-MM-DD`.

![Apify Actor input schema - country input](./images/input-schema-date-absolute.png)

The `relative_date` property renders an input field that enables the user to choose the relative date and returns the value in the format `+/- {number} {unit}`, for example `"+ 2 days"`. The `allowAbsolute` parameter is set to `false` to restrict input to relative dates only.

![Apify Actor input schema - country input](./images/input-schema-date-relative.png)

The `any_date` property renders a date picker that accepts both absolute and relative dates. The Actor author is responsible for parsing and interpreting the selected date format.

![Apify Actor input schema - country input](./images/input-schema-date-both.png)

Properties:

| Property | Value | Required | Description |
|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|
| `editor` | One of <ul><li>`textfield`</li><li>`textarea`</li><li>`javascript`</li><li>`python`</li><li>`select`</li><li>`datepicker`</li><li>`hidden`</li></ul> | Yes | Visual editor used for <br/>the input field. |
| `pattern` | String | No | Regular expression that will be <br/>used to validate the input. <br/> If validation fails, <br/>the Actor will not run. |
| `minLength` | Integer | No | Minimum length of the string. |
| `maxLength` | Integer | No | Maximum length of the string. |
| `enum` | [String] | Required if <br/>`editor` <br/>is `select` | Using this field, you can limit values <br/>to the given array of strings. <br/>Input will be displayed as select box. |
| `enumTitles` | [String] | No | Titles for the `enum` keys described. |
| `nullable` | Boolean | No | Specifies whether `null` <br/>is an allowed value. |
| `isSecret` | Boolean | No | Specifies whether the input field<br />will be stored encrypted.<br />Only available <br />with `textfield` and `textarea` editors. |
| Property | Value | Required | Description |
|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `editor` | One of <ul><li>`textfield`</li><li>`textarea`</li><li>`javascript`</li><li>`python`</li><li>`select`</li><li>`datepicker`</li><li>`hidden`</li></ul> | Yes | Visual editor used for <br/>the input field. |
| `pattern` | String | No | Regular expression that will be <br/>used to validate the input. <br/> If validation fails, <br/>the Actor will not run. |
| `minLength` | Integer | No | Minimum length of the string. |
| `maxLength` | Integer | No | Maximum length of the string. |
| `enum` | [String] | Required if <br/>`editor` <br/>is `select` | Using this field, you can limit values <br/>to the given array of strings. <br/>Input will be displayed as select box. |
| `enumTitles` | [String] | No | Titles for the `enum` keys described. |
| `nullable` | Boolean | No | Specifies whether `null` <br/>is an allowed value. |
| `isSecret` | Boolean | No | Specifies whether the input field<br />will be stored encrypted.<br />Only available <br />with `textfield` and `textarea` editors. |
| `allowAbsolute` | Boolean | No | Enables absolute date input in `YYYY-MM-DD` format. Only available with `datepicker` editor. <br/><br/>Defaults to `true`. |
| `allowRelative` | Boolean | No | Enables relative date input in <br/>`+/- {number} {unit}` format. <br/>Supported units are: days, weeks, months, years. <br/><br/>The input is passed to the Actor as plain text (e.g., "+3 weeks"). To parse it, regex like this can be used: `^([+-])\s*(\d+)\s*(day\|week\|month\|year)s?$`.<br/><br/>Set `allowAbsolute` to `false` to allow only relative input, otherwise both formats are supported. Only available with `datepicker` editor. |

:::note Regex escape

Expand Down