How to set date format for date-signed and editable-date fields using BoldSign API?

You can apply date format to EditableDate and DateSigned fields to specify the desired format for displaying date values.

Supported date formats

BoldSign API supports a variety of date formats, including:

  • MM/dd/yyyy
  • dd/MM/yyyy
  • dd-MMM-yyyy
  • MMM-dd-yyyy
  • MMM dd,yyyy
  • dd MMM,yyyy
  • yyyy,MMM dd
  • yyyy/MM/dd
  • dd-MM-yyyy
  • MM-dd-yyyy
  • yyyy-MM-dd

Applying date format to editable date fields

To apply a date format to the EditableDate fields, use the dateFormat property in the EditableDateFieldSettings object.

Applying date format to date digned fields

To apply a date format to the DateSigned fields, use the dateFormat property.

Default date format

If no format is specified, BoldSign uses the default format from your account settings, which you can manage in your BoldSign Business profile.

Here are example codes you can use to set the date format for date fields:

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": "DateSigned",
      "name": "DateSigned",
      "fieldType": "DateSigned",
      "pageNumber": 1,
      "bounds": {
        "x": 100,
        "y": 100,
        "width": 125,
        "height": 25
      },
      "isRequired": true,
      "dateFormat": "dd/MM/yyyy"
    },
    {
      "id": "EditableDate",
      "name": "EditableDate",
      "fieldType": "EditableDate",
      "pageNumber": 1,
      "bounds": {
        "x": 100,
        "y": 100,
        "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 DateSignedField = new DateSignedField(
    isRequired: true,
    pageNumber: 1,
    bounds: new Rectangle(x: 100, y: 100, width: 125, height: 25),
    dateFormat:"dd/MM/yyyy",
    id: "DateSignedField"
    );

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"));

var formFieldCollections = new List<FormField>()
{
    DateSignedField,
    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()
{
    DisableEmails = true,
    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": "DateSigned",
      "name": "DateSigned",
      "fieldType": "DateSigned",
      "pageNumber": 1,
      "bounds": {
        "x": 100,
        "y": 100,
        "width": 125,
        "height": 25
      },
      "isRequired": True,
      "dateFormat": "dd/MM/yyyy"
    },
    {
      "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": "DateSigned",\r\n      "name": "DateSigned",\r\n      "fieldType": "DateSigned",\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  "isReadOnly": true,\r\n  "dateFormat": "dd/MM/yyyy",\r\n  "isRequired": true\r\n}\r\n  ],\r\n  "locale": "EN"\r\n}');
data.append('Signers', '{\r\n  "name": "hanky",\r\n  "emailAddress": "hankyWhites1@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  "dateFormat": "dd/MM/yyyy",\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 above example, set the fieldType as dateSigned or editableDate and dateFormat property to one of the supported date formats. Upon executing the above code, a document will be generated with the specified date format values for the date signed and editable date fields.