JavaScripTools Manual

JavaScriptUtil

The declared constants

There are some constants declared on JavaScriptUtil. They relate to different groups. Here they are:

Character sets

String constants that contains sets of characters, useful for creating InputMask fields, or using the onlySpecified function.

They are:

Constant Meaning
JST_CHARS_NUMBERS Only numeric digits
JST_CHARS_LOWER Only lowercase letters, including variations, like ç, À, etc
JST_CHARS_UPPER Only uppercase letters, including variations, like ç, À, etc
JST_CHARS_LETTERS The concatenation of JST_CHARS_LOWER and JST_CHARS_UPPER
JST_CHARS_ALPHA The concatenation of JST_CHARS_LETTERS and JST_CHARS_NUMBERS
JST_CHARS_BASIC_LOWER Only the basic, unpunctuated, lowercase letters (a - z)
JST_CHARS_BASIC_UPPER Only the basic, unpunctuated, uppercase letters (A - Z)
JST_CHARS_BASIC_LETTERS The concatenation of JST_CHARS_BASIC_LOWER and JST_CHARS_BASIC_UPPER
JST_CHARS_BASIC_ALPHA The concatenation of JST_CHARS_BASIC_LETTERS and JST_CHARS_NUMBERS
JST_CHARS_WHITESPACE The whitespaces (space, tab and line breaks)

Time constants

Number constants that contains the number of milliseconds on different time fields. Since the JavaScript Date means the number of elapsed milliseconds since January 1, 1970, 00:00:00 GMT, when performing time comparisions, it might be useful to have a constant holding, for example, the number of milliseconds in an hour. Note that it's only possible on the seconds, minutes, hours and days, since, monthes have a variable number of days. They are:

Constant Meaning
MILLIS_IN_SECOND The number of milliseconds in a second
MILLIS_IN_MINUTE The number of milliseconds in a minute
MILLIS_IN_HOUR The number of milliseconds in an hour
MILLIS_IN_DAY The number of milliseconds in a day

Date field

Some functions, like dateDiff and truncDate requires a field to operate, for example: The difference between 2 dates in seconds, or in days.

The possible fields are represented by the following constants:

Constant Meaning
JST_FIELD_SECOND Seconds
JST_FIELD_MINUTE Minutes
JST_FIELD_HOUR Hours
JST_FIELD_DAY Day
JST_FIELD_MONTH Months
JST_FIELD_YEAR Years



Previous:
Introduction to JavaScriptUtil
Table of Contents Next:
Working with strings