NC Date Range
Not yet released: this component will ship in an upcoming Native Rent package version.
NC Date Range is a start and end date picker with a calendar. Booked and blocked dates are shaded and cannot be picked. It outputs the Start Date, End Date, and number of Nights.
Use it for a rental window, a stay, or any scheduled period.
Layouts
| Layout | API value | What the user sees | Example |
|---|---|---|---|
| Auto | auto | One month on a phone or a narrow column. Two months on a wide screen. | A booking screen used on desktop and phone. |
| One month | one | One month plus the date fields. | A narrow column. |
| Two months | two | Two months side by side plus the date fields. | A wide desktop booking panel. |
Auto shows one month on a phone or when the component is under 600 px wide.
A first click sets the start. A click on a later date sets the end. The next click starts a new range. A click on a date before the start moves the start. Users can also type dates in the fields.
Booked and blocked dates
- Booked Records is a record collection of booked periods. Each record needs a start date and an end date. Start Field is blank by default, which uses StartDate. End Field is blank by default, which uses EndDate. Store these fields in Get Records.
- The end date counts as the departure morning, so that day can still be picked. The nights from the start up to the end are shaded and cannot be picked.
- Blocked Dates is an optional comma-separated list of dates in
YYYY-MM-DDformat. These are shaded and cannot be picked. A blocked date cannot be the start or the end. - Earliest Date and Latest Date are optional.
- Minimum Nights defaults to 1. Maximum Nights defaults to 0, which means no maximum.
Add it to a screen
- Add NC Date Range to the screen. Set Label, and turn on Required if a full range is needed.
- Optionally map a Booked Records collection, and set Start Field and End Field, or leave them blank for StartDate and EndDate.
- Set Earliest Date, Latest Date, Minimum Nights, and Maximum Nights as needed. Add blocked dates as
YYYY-MM-DDvalues. - Map Start Date and End Date in and out of the same variables. Use Nights later in the flow if you need the length.
Validation
Next is blocked when the range is required and not complete, is shorter or longer than the night limits, or overlaps a booked or blocked date. The component shows its own message for each case. Booked days cannot be clicked.
While the end date is being picked, days after the start that would give fewer nights than Minimum Nights, or more than Maximum Nights, are struck through and cannot be picked. A screen reader reads the reason with the date, for example "Choose at least 3 nights." A typed end date that breaks the limit is cleared, the start is kept, and the message shows. A range that is set another way, for example by changing the start date afterwards, still shows the message and blocks Next.
When a date is not picked, Start Date or End Date is sent to the flow as empty (null), not as empty text.
Phone and desktop
Auto shows one month on a phone or a narrow column, and two months on a wide screen. 44 px touch targets apply at 600 px or less, on a phone, or on a touch screen. Map Start Date and End Date in and out of the same variables to keep the range if the screen is re-created. NC Date Range has no Color Map.
Limits
- Get Records must store the booked start and end fields. "Automatically store all fields" is not enough.
- Booked ranges end on the departure morning, so that day stays free.
- A blocked date cannot be the start or the end.
Properties
| Property | API name | Default | Description |
|---|---|---|---|
| Label | fieldLabel | (blank) | Question or field label shown above the calendar. |
| Help Text | helpText | (blank) | Optional hint under the label. |
| Required | required | false | Block Next until a start and end date are selected. |
| Required Message | requiredMessage | (blank) | Optional. Blank uses the translated default. |
| Disabled | disabled | false | Show the calendar read-only. |
| Booked Records | bookedRecords | (blank) | Optional record collection of booked or blocked periods. Each record needs a start date and an end date (see Start Field and End Field). |
| Start Field | bookedStartField | (blank) | Field API name for the start date on each booked record. Blank uses StartDate. |
| End Field | bookedEndField | (blank) | Field API name for the end date on each booked record. Blank uses EndDate. The end date is treated as the departure morning, so that day can still be selected. |
| Blocked Dates | bookedDates | (blank) | Optional comma-separated dates (YYYY-MM-DD) to shade and block, in addition to booked records. |
| Earliest Date | minDate | (blank) | Optional. Dates before this cannot be selected. |
| Latest Date | maxDate | (blank) | Optional. Dates after this cannot be selected. |
| Minimum Nights | minNights | 1 | Minimum nights in the range (0 = no minimum). Default 1. |
| Maximum Nights | maxNights | 0 | Maximum nights (0 = no maximum). |
| Layout | layout | auto | auto (default), one or two. Auto: one month on phones or under 600px, two months on wide screens. |
| Accent Color | accentColor | (blank) | Selected and focus color, e.g. #0B5CAB. Hex, rgb() or a color name. Lightened or darkened until it reaches 3:1 against the tile color (or the theme surface if no tile is set). Also tints the focus ring and the selected/highlighted row. Blank follows the org theme (and dark mode). |
| Background Color | backgroundColor | (blank) | Optional color behind the whole component. |
| Text Color | textColor | (blank) | Optional. On choices and results: used as-is on the theme surface, or checked at 4.5:1 against a tile color if one is set. On the label and help: checked at 4.5:1 against the background if one is set; otherwise dark or white text is picked automatically. |
| Text Size | size | medium | small, medium (default), large or xlarge. |
| Corner Shape | shape | rounded | rounded (default), square or pill. |
| Alignment | align | start | start (default), center or end. |
| Navigate After Selection | navigateOnSelect | none | none (default), next, back, finish or pause. After a complete range is picked the Flow can move on, so you can hide the screen footer buttons. Next and Finish check Required first; Next becomes Finish on the last screen. |
| Available Actions | availableActions | (blank) | Set by Flow; do not map. |
Outputs
| Output | API name | Type | Direction | Description |
|---|---|---|---|---|
| Start Date | startDate | Date | Input and output | Selected start date. Map in to prefill, out to read the choice. |
| End Date | endDate | Date | Input and output | Selected end date. Map in to prefill, out to read the choice. |
| Nights | nights | Number | Output | Number of nights between the start and end dates (0 until both are set). |
Shared behavior
Layout and width, required messages, colors, navigation, data sources, translations, accessibility, and the setup panel work the same way on every component. See NC screen components.
To copy this component's settings to another screen, use Copy settings at the top of its setup panel. See Copy settings.