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

SimpleDateTime

Extends:

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

The purpose of SimpleDateTime is to store a date and time. It will write to your tool's XML configuration the text of the date and time value set on it. It uses moment.js (https://momentjs.com/) for parsing and formatting date and time 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 tools XML configuration independent of the format of the string used for display. The default value is the current date and time in format of "YYYY\MM\DD hh:mm:ss".

Constructor Summary

Public Constructor
public

constructor(dataName: string, dataItemProps: object)

Constructor

Member Summary

Public Members
public

Function that returns the current date format for the data item.

public

Function that returns the current delimiter between the date and time format for the data item.

public

Function that returns the current format for the date, time or datetime with delimiter for the data item.

public

Function that returns the current persistence format for the data item.

public

Function that returns the current time format for the data item.

public

setDateFormat(dateFormat: string): *

Function that changes the current date format for the data item.

public

setDateTimeDelimiter(delimiter: string): *

Function that changes the current delimiter between the date and time for the data item.

public

setPersistenceFormat(persistenceFormat: string): *

Function that changes the current persistence format for the data item.

public

setTimeFormat(timeFormat: string): *

Function that changes the current time format for the data item.

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.dateTimeDelimiter string
  • optional
  • default: ' '

The "dateTimeDelimiter" property is used as the delimiter between the date and time formatting strings for display.

dataItemProps.timeFormat string
  • optional
  • default: 'HH:mm:ss'

The "timeFormat" property is used for displaying the time. 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 HH:mm:ss'

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/

Public Members

public getDateFormat: string: * source

Function that returns the current date format for the data item.

Return:

string

The current date format.

public getDateTimeDelimiter: string: * source

Function that returns the current delimiter between the date and time format for the data item.

Return:

string

The current time format.

public getDisplayFormat: string: * source

Function that returns the current format for the date, time or datetime with delimiter for the data item.

Return:

string

The date, time or datetime format with delimiter included

public getPersistenceFormat: string: * source

Function that returns the current persistence format for the data item.

Return:

string

The current date format.

public getTimeFormat: string: * source

Function that returns the current time format for the data item.

Return:

string

The current time format.

public setDateFormat(dateFormat: string): * source

Function that changes the current date format for the data item.

public setDateTimeDelimiter(delimiter: string): * source

Function that changes the current delimiter between the date and time for the data item.

public setPersistenceFormat(persistenceFormat: string): * source

Function that changes the current persistence format for the data item.

public setTimeFormat(timeFormat: string): * source

Function that changes the current time format for the data item.