Skip to content

Date Selection Range Restriction

Background

In a certain project, the customer needs that when creating a project quotation form in the project management system, the start time cannot be greater than the end time, and the end time cannot be less than the start time.

When using expressions, variables and functions are enclosed in ${ }.

Implementation Steps

  • Enter the system application design, select the "Project Quotation" data table, and select "Form Fields"

  • Select the "Start Date" field, click Edit, and enter the field editing page

  • On the field editing page, find "Dates not allowed to be selected when the following conditions are met", and click "Expression Editor" to enter the expression editing page; here you need to get all dates greater than "Finish Time" through expressions

  • On the expression editor page, select [Date]

  • Edit the expression, click "Form Data", select "End Date" from the expanded list, and organize the expression as date>record.finishTime, then click OK to save

  • Similarly, in the "Project Quotation" data table, select the "End Date" field, click Edit, and enter the field editing page

  • On the field editing page, find "Dates not allowed to be selected when the following conditions are met", and click "Expression Editor" to enter the expression editing page; here you need to get all dates less than "Start Time" through expressions

  • On the expression editor page, select [Date]

  • Edit the expression, click "Form Data", select "Start Date" from the expanded list, and organize the expression as date<record.startTime, then click OK to save

  • Return to the field settings interface, check that the configuration is correct, click Save, publish the application, and complete the configuration

Effect

  • When creating a new project quotation, if the start date is selected as "2023-09-27", the end date can only be selected from "2023-09-27" and later. Dates earlier than this are grayed out and cannot be selected, as shown below: