Home Reference Source
import ConstrainedDate from './gui/data-items/ConstrainedDate.jsx'
public class | source

ConstrainedDate

Extends:

gui/data-items/SimpleDateTime.js~SimpleDateTime → ConstrainedDate

The purpose of ConstrainedDate is to store a date with constraints on the value. It will write to your tool's XML configuration the text of the date value set on it. It uses moment.js (https://momentjs.com/) for parsing and formatting date data. The display format and persistence format can be controlled through properties using moment.js formatting strings (https://momentjs.com/docs/#/displaying/format/). You can change the format of the string it persists in your tool XML configuration independent of the format of the string used for display. The default value is the current date in format of "YYYY-MM-DD".

Constructor Summary

Public Constructor
public

constructor(dataName: string, dataItemProps: object)

Constructor

Public Constructors

public constructor(dataName: string, dataItemProps: object) source

Constructor

Params:

NameTypeAttributeDescription
dataName string

The name of the data item.

dataItemProps object
  • optional

An object of properties such as hidden, disabled, suppressed etc.

dataItemProps.dateFormat string
  • optional
  • default: 'YYYY-MM-DD'

The "dateFormat" property is used for displaying the date. This string is used by moment.js for formatting, so is in its formatting syntax. You can find a reference for that here: https://momentjs.com/docs/#/parsing/string-format/

dataItemProps.persistenceFormat string
  • optional
  • default: 'YYYY-MM-DD'

The "persistenceFormat" property is used for persisting the date in the tools XML configuration. This string is used by moment.js for formatting, so is in its formatting syntax. You can find a reference for that here: https://momentjs.com/docs/#/parsing/string-format/

dataItemProps.min string
  • optional
  • default: undefined

The min property specifies the minimum date allowed. The format must match the dateFormat specific format.

dataItemProps.max string
  • optional
  • default: undefined

The max property specifies the maximum date allowed. The format must match the dateFormat specific format.