How to set date range for editable date fields using BoldSign API?

BoldSign's API allows you to send documents out for signature with editable date fields. This will be useful for situations where you need the signer to enter a specific date, such as a contract start date or a payment due date. To provide a date range for an EditableDate field, you can use the minDate and maxDate properties of the editableDateFieldSettings object.

How to set min date and max date:

The minDate and maxDate properties are optional. If left unspecified, the signer will have the flexibility to choose any date. However, if you set minDate to "11/28/2023" and maxDate to "12/28/2023," the signer will be restricted to selecting a date within the specified range.

Code snippet

curl -X 'POST' \
  'https://api.boldsign.com/v1/document/send' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: {your API key}' \
  -H 'Content-Type: multipart/form-data' \
  -F 'Title="Sample Document"' \
  -F 'Signers={
  "name": "hanky",
  "emailAddress": "hankyWhites@gmail.com",
  "signerType": "Signer",
  "signerRole": "Signer",
  "formFields": [
    {
      "id": "EditableDate",
      "name": "EditableDate",
      "fieldType": "EditableDate",
      "pageNumber": 1,
      "bounds": {
        "x": 200,
        "y": 200,
        "width": 125,
        "height": 25
      },
      "isRequired": true,
      "editableDateFieldSettings": {
        "dateFormat": "dd/MM/yyyy",
        "minDate": "2023-07-01T18:18:08.567Z",
        "maxDate": "2023-07-31T18:18:08.567Z"
        }
    }
  ],
  "locale": "EN"
}' \
  -F 'Files=@{your file}' \
var apiClient = new ApiClient("https://api.boldsign.com", "{Your API key}");
var documentClient = new DocumentClient(apiClient);

var documentFilePath = new DocumentFilePath
{
    ContentType = "application/pdf",
    FilePath = "{Your File path}"
};

var filesToUpload = new List<IDocumentFile>
{
    documentFilePath,
};

var EditableDateField = new FormField(
    id: "EditableDate",
    isRequired: true,
    type: FieldType.EditableDate,
    pageNumber: 1,
    bounds: new Rectangle(x: 200, y: 200, width: 125, height: 25),
    editableDateFieldSettings: new EditableDateFieldSettings(dateFormat:"dd/MM/yyyy", minDate: DateTime.Now, maxDate: DateTime.Now.AddDays(10)));

var formFieldCollections = new List<FormField>()
{
    EditableDateField
};

var signer = new DocumentSigner(
    signerName: "David",
    signerEmail: "david@cubeflakes.com",
    formFields: formFieldCollections,
    locale: Locales.EN);

var documentSigners = new List<DocumentSigner>()
{
    signer
};

var sendForSign = new SendForSign()
{
    Signers = documentSigners,
    Title = "Sample Document",
    Files = filesToUpload
};
var documentCreated = documentClient.SendDocument(sendForSign);
Console.WriteLine(documentCreated.DocumentId);
import requests
import json

url = "https://api.boldsign.com/v1/document/send"

signer_data = {
    "name": "hanky",
    "emailAddress": "hankyWhites@gmail.com",
    "signerType": "Signer",
    "signerRole": "Signer",
    "formFields": [
    {
      "id": "EditableDate",
      "name": "EditableDate",
      "fieldType": "EditableDate",
      "pageNumber": 1,
      "bounds": {
        "x": 200,
        "y": 200,
        "width": 125,
        "height": 25
      },
      "isRequired": True,
      "editableDateFieldSettings": {
        "dateFormat": "dd/MM/yyyy",
        "minDate": "2023-07-01T18:18:08.567Z",
        "maxDate": "2023-07-31T18:18:08.567Z"
        }
    }
    ],
    "locale": "EN"
}

payload = {
    'Signers': json.dumps(signer_data),
    'Title': "Sample Document"
}

files = [
    ('Files', ('{Your file name}', open('{Your file path}', 'rb'), 'application/pdf'))
]

headers = {
    'accept': 'application/json',
    'X-API-KEY': '{Your API key}'
}

response = requests.post(url, headers=headers, data=payload, files=files)

print(response.text)
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
let data = new FormData();
data.append('Signers', '{\r\n  "name": "hanky",\r\n  "emailAddress": "hankyWhites@gmail.com",\r\n  "signerType": "Signer",\r\n  "signerRole": "Signer",\r\n  "formFields": [\r\n    {\r\n      "id": "EditableDate",\r\n      "name": "EditableDate",\r\n      "fieldType": "EditableDate",\r\n      "pageNumber": 1,\r\n      "bounds": {\r\n        "x": 100,\r\n        "y": 100,\r\n        "width": 200,\r\n        "height": 200\r\n      },\r\n "editableDateFieldSettings": {\r\n "dateFormat": "dd/MM/yyyy",\r\n "minDate": "2023-07-01T18:18:08.567Z", \r\n "maxDate": "2023-07-31T18:18:08.567Z"\r\n },\r\n "isReadOnly": true,\r\n "isRequired": true\r\n}\r\n  ],\r\n  "locale": "EN"\r\n}');
data.append('Files', fs.createReadStream('{Your file path}'));
data.append('Title', "Sample Document");

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api.boldsign.com/v1/document/send',
  headers: { 
    'accept': 'application/json', 
    'X-API-KEY': '{Your API key}', 
    ...data.getHeaders()
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

In the given example, replace the minDate and maxDate values with the desired dates. Set the field type as EditableDate and configure the minDate and maxDate properties according to the supported date formats. Upon executing the provided code, a document will be generated with the specified date range values for the editable date form fields.