Date and time - Date type
FastGrid documentation
Date type shows date and / or time in selected format.
It supports direct editing or selecting the date(s) from popup calendar.
Format
Date type can be explicitly set by Type = "
Date"
or it can be automatically chosen according to
Format by default Type = "
Auto"
The date values in input JSON and by API
GetValue /
SetValue can be set as
number or as
string.
The date values as
number are the
fastest to parse and can be:
ExcelDates=
0: integer number of milliseconds since 1/1/1970 00:00:00. Time only is between 0 - 86,400,000
ExcelDates=
1: floating point number of days since 12/31/1899 (and includes not existing day 2/29/1900), the same as MS Excel. Time only is between 0.0 - 1.0.
Setting dates as numbers is strongly recommended for large grids. Reading 1M cells takes 50 ~ 200ms.
The
fast recommended date string formats are: "
M/d/yyyy" and "
yyyy/M/d".
The
fast recommended time string format are: "
H:m", "
H:m:s", "
h:m am/pm", "
h:m:s am/pm".
The date string can contain only
date, only
time or
data + time separated by one space. No other spaces should be used.
For example: "12/31/2021", "12:34:56", "1/9/2021 4:2:6", "01/09/2021 04:02:06 am".
Reading 1M cells in the fast date strings takes 500 ~ 1500ms.
Other acceptable string formats with
slower parsing are:
date: "yyyy-M-d", "M-d", "M/d/yyyy", "M/d", "d.M.yyyy" (d.M is not permitted)
time: "H:m", "H:m:s", "H.m", "H.m.s", "h:m", "h.m.s", "h.m", "h.m.s" with am / pm, AM / PM, a.m. / p.m., A.M. / P.M. (with or without space after time)
If set only time, it cannot be separated by dot.
Reading 1M cells in the slow date strings takes 1000 ~ 2000ms.
The date format in data can be more specified by
DateFormatIn.
The edited date values and set by
SetString are saved according to
DateFormatOut.
The date values are uploaded to server as they are set.
Date format string to be used to parse the date values in input JSON and by API
GetValue /
SetValue.
It can be set also to
1 to use always the
slower date strings (see in the
V / Value) to avoid browser dependent date parsing.
Specifies how dates are saved after editing or setting by API
SetString.
0 - as number according to
ExcelDates.
1 - as date string according to
DateSeparator:
'/' - M/d/yyyy HH:mm:ss or M/d/yyyy HH:mm or M/d/yyyy or HH:mm:ss or HH:mm
'.' - d.M.yyyy HH:mm:ss or d.M.yyyy HH:mm or d.M.yyyy or HH:mm:ss or HH:mm
'-' - yyyy-M-d HH:mm:ss or yyyy-M-d HH:mm or yyyy-M-d or HH:mm:ss or HH:mm
2 - as date string according to
DateSeparator:
'/' - MM/dd/yyyy HH:mm:ss or MM/dd/yyyy HH:mm or MM/dd/yyyy or HH:mm:ss or HH:mm
'.' - dd.MM.yyyy HH:mm:ss or dd.MM.yyyy HH:mm or dd.MM.yyyy or HH:mm:ss or HH:mm
'-' - yyyy-MM-dd HH:mm:ss or yyyy-MM-dd HH:mm or yyyy-MM-dd or HH:mm:ss or HH:mm
Or it can be set to exact date format string to not omit the not set date parts like time, the supported formats are only the formats listed in points 1 and 2.
0 - all dates in grid are integer numbers as count of milliseconds since 1/1/1970.
1 - all dates in grid are floating point numbers as count of days since 1/1/1900.
It affects everything, input data and output data if dates are numbers and all dates for API.
Setting to
1 is useful especially if importing
xlsx file with dates.
If set and the
Date Type or
Auto Type with date cannot be displayed whole, it is shown as "###" error.
If set, the
Format can contain HTML code.
Remember, the code must be in '' or "" and must contain only inline tags, like Html type.
Using many cells with HTML code remarkably slows down paint!
Default date (and time) shown in calendar for empty dates. Can be set as number or date string like the
V / Value
Used also when editing date / time in cell, the missing parts in the input are got from the DefaultDate.
For example input: "12/12" and DefaultDate: "1/1/2000 21:30" will return "12/12/2000 21:30"
Specifies date and / or time string format - how the date and / or time will be displayed.
This format string uses almost the same formatting as Microsoft .NET System.DateTime.
ToString (string format) function.
Empty format
If the
Format is not set or is empty (default), it is used default format according to
DateSeparator:
'/' - M/d/yyyy HH:mm:ss or M/d/yyyy HH:mm or M/d/yyyy or HH:mm:ss or HH:mm
'.' - d.M.yyyy HH:mm:ss or d.M.yyyy HH:mm or d.M.yyyy or HH:mm:ss or HH:mm
'-' - yyyy-M-d HH:mm:ss or yyyy-M-d HH:mm or yyyy-M-d or HH:mm:ss or HH:mm
If some part of the date is 0, it is omitted, some examples: "5/9/2000 12:43:56", "12:00", "6/5/2000".
Auto format (two letters)
This format uses different date format according to the date value, to hide the empty parts from the date, e.g. zero time or current year.
It is designed to use also in
AutoDateFormat.
a1 or A1 | date+time, date, time, with or without seconds | "M/d/yyyy", "M/d/yyyy HH:mm", "M/d/yyyy HH:mm:ss", "HH:mm", "HH:mm:ss" |
a2 or A2 | a1 + date without current year | a1 + "M/d", "M/d HH:mm", "M/d HH:mm:ss" |
a3 or A3 | a2 + day without current month | "d", "d HH:mm", "d HH:mm:ss", "'today'", "'yesterday'", "'tomorrow'" |
a4 or A4 | a3 + hours without minutes | "M/d/yyyy HH", "M/d HH", "d HH", "HH" |
The lowercase '
ax' use localized
Standard format parts, the uppercase '
Ax' uses
Standard full format.
Standard format parts (two or three letters)
Localized in all languages. Separated date and time, to use date with time use
Assembled format like "*sd* *tm*".
This format loads user format from file
Texts.js in JSON object
Format.
It should not start by '
n' to not collide with number formats.
sd | Short partial date | US:"M/d", GB: "d/M", DE:"d.M" |
sy | Short full date | US:"M/d/yyyy", GB:"d/M/yyyy", DE:"d.M.yyyy" |
sw | Short full date with week day | US:"ddd M/d/yyyy", GB:"ddd d/M/yyyy", DE:"ddd d.M.yyyy" |
sm | Short month and year | US:"M/yyyy", GB:"M/yyyy", DE:"M/yyyy" |
sn | Short week number | US:"\wddddddd", GB:"\wddddddd", DE:"\Wddddddd" |
ld | Long partial date | US:"MMMM d", GB:"dddddd MMMM", DE:"dddddd MMMM" |
ly | Long full date | US:"MMMM d, yyyy", GB:"dddddd MMMM yyyy", DE:"dddddd MMMM yyyy" |
lw | Long full date with week day | US:"dddd, MMMM d, yyyy", GB:"dddd, dddddd MMMM yyyy", DE:"dddd dddddd MMMM yyyy" |
lwa | Long full date with abbreviated week day | US:"ddd, MMMM d, yyyy", GB:"ddd, dddddd MMMM yyyy", DE:"ddd dddddd MMMM yyyy" |
lm | Long month and year | US:"MMMMMMM yyyy", GB:"MMMMMMM yyyy", DE:"MMMMMMM yyyy" |
ln | Long week number | US:"'week' ddddddd", GB:"'week' ddddddd", DE:"'Woche' ddddddd" |
ad | Abbreviated partial date | US:"MMM d", GB:"dddddd MMM", DE:"dddddd MMM" |
ay | Abbreviated full date | US:"MMM d, yyyy", GB:"dddddd MMM yyyy", DE:"dddddd MMM yyyy" |
aw | Abbreviated full date with week day | US:"ddd, MMM d, yyyy", GB:"ddd, dddddd MMM yyyy", DE:"ddd dddddd MMM yyyy" |
awl | Abbreviated full date with long week day | US:"dddd, MMM d, yyyy", GB:"dddd, dddddd MMM yyyy", DE:"dddd dddddd MMM yyyy" |
am | Abbreviated month and year | US:"MMMMMMM yyyy", GB:"MMMMMMM yyyy", DE:"MMMMMMM yyyy" |
an | Abbreviated week number | US:"'week' ddddddd", GB:"'week' ddddddd", DE:"'Woche' ddddddd" |
th | Standalone time, hours only | US:"h tt", GB:"HH", DE:"HH" |
tm | Standalone time, hours and minutes | US:"h:mm tt", GB:"HH:mm", DE:"HH:mm" |
ts | Standalone time, hours, minutes and seconds | US:"h:mm:ss tt", GB:"HH:mm:ss", DE:"HH:mm:ss" |
tf | Standalone time, hours, minutes, seconds and ms | US:"HH:mm:ss.fff", GB:"HH:mm:ss.fff", DE:"HH:mm:ss.fff" |
sth | Time for short date, hours only | US:" h tt", GB:" HH", DE:" HH" |
stm | Time for short date, hours and minutes | US:" h:mm tt", GB:" HH:mm", DE:" HH:mm" |
sts | Time for short date, hours, minutes and seconds | US:" h:mm:ss tt", GB:" HH:mm:ss", DE:" HH:mm:ss" |
stf | Time for short date, hours, minutes, seconds and ms | US:" HH:mm:ss.fff", GB:" HH:mm:ss.fff", DE:" HH:mm:ss.fff" |
lth | Time for long date, hours only | US:", h tt", GB:", HH", DE:", HH" |
ltm | Time for long date, hours and minutes | US:", h:mm tt", GB:", HH:mm", DE:", HH:mm" |
lts | Time for long date, hours, minutes and seconds | US:", h:mm:ss tt", GB:", HH:mm:ss", DE:", HH:mm:ss" |
ltf | Time for long date, hours, minutes, seconds and ms | US:", HH:mm:ss.fff", GB:", HH:mm:ss.fff", DE:", HH:mm:ss.fff" |
yq | Year and quarter | US:"MMMMM yyyy", GB:"MMMMM yyyy", DE:"MMMMM yyyy" |
yq | Year and half | US:"MMMMMM yyyy", GB:"MMMMMM yyyy", DE:"MMMMMM yyyy" |
Standard full format (one letter)
Auto format is
one letter format. This format loads user format from file
Texts.js, JSON object
Format.
d | Short date | ("M/d/yyyy") |
h | Short date + short time | ("M/d/yyyy H:mm") |
H | Short date + long time | ("M/d/yyyy H:mm:ss") |
j | Short date + short time with am/pm | ("M/d/yyyy h:mm tt") |
J | Short date + long time with am/pm | ("M/d/yyyy h:mm:ss tt") |
m | Day and short month | ("M/d") |
y | Short month and year | ("M/yyyy") |
t | Short time | ("H:mm") |
T | Long time | ("H:mm:ss") |
i | Short time with am/pm | ("h:mm tt") |
I | Long time with am/pm | ("h:mm:ss tt") |
D | Long date | ("d. MMMM yyyy") |
l | Long date + short time | ("d. MMMM yyyy H:mm") |
L | Long date + long time | ("d. MMMM yyyy H:mm:ss") |
k | Long date + short time with am/pm | ("d. MMMM yyyy h:mm tt") |
K | Long date + long time with am/pm | ("d. MMMM yyyy h:mm:ss tt") |
M | Day and long month | ("d. MMMM") |
Y | Long month and year | ("MMMMMMM yyyy"). For month name uses the attribute LongMonthNames2 (from file Texts.js, object Format). LongMonthNames2 could contain noun's first case if the language supports it. |
u | Universal sortable date time | ("yyyy-MM-dd HH:mm:ssZ") |
U | Universal date time | for example: 13. January 2004 17:12:34. |
R | RFC1123 | ("ddd MMM d HH:mm:ss UTCzzzzz yyyy"), for example: Tue, 13 Jan 2004 18:12:34 GMT |
a | Long date with week | ("dddd, dddddd MMMM yyyy") |
Assembled format
If the format string contains asterisk (*), it loads the user defined formats from the
Format object.
For example:
Format: { d1:'d/M/yy' d2:'d/M' d3:'yyyy' t1=' HH:mm' },
Format: "*d1" is converted to "d.M.yy",
Format: "d1*t1" is converted to "d.M.yy HH:mm",
Format: "d2*/*d3*+++*t1" is converted to "d/M/yyyy+++ HH:mm".
The assembled format can refer Standard predefined formats (
Parts or
Full) and any predefined
user format.
The assembled format can refer another assembled format, these references should contain asterisk on both sides.
User format
User format can contain any characters but only few have special meaning and other are written into output without any change.
It is recommended to escape all the not white characters without format meaning by "\" or in "" or ''. For example
"'day' d 'in month' M"
Especially number format characters '
0', '
#', '
?', '
8' should be escaped.
: | Place for time separator, defined in file Texts.js in object Format, attribute TimeSeparator. (colon by default). |
/ | Place for time separator, defined in file Texts.js, object Format, attribute DateSeparator. (slash by default). |
d | Month days 1 - 31 |
dd | Month days 01 - 31 |
ddd | Weekdays Sun - Sat |
dddd | Weekdays Sunday - Saturday |
ddddd | Weekdays S - S |
dddddd | Month days 1st - 31st |
ddddddd | Year weeks 1 - 52 |
dddddddd | Year weeks 01 - 52 |
D | not used |
DD | The rest of days in week, in count of weeks from 1/1/1970 (it is not weekday!) |
DDD | Year day 0 - 365 |
DDDD | Count of days from 1/1/1970, for duration in days. It is accepted also as [d] |
DDDDD | Count of weeks from 1/1/1970, for duration in weeks, see DD |
DDDDDD | Tenths of month days: empty,1,2,3 |
DDDDDDD | Month days: 1-9,0-9,0-9,0-1 |
M | Month 1 - 12 |
MM | Month 01 - 12 |
MMM | Month Jan - Dec |
MMMM | January - December |
MMMMM | Year quarters, I, II, III, IV |
MMMMMM | Year halves, I, II |
MMMMMMM | January - December, used LongMonthNames2 for languages with inflection |
y | Year 0 - 99 |
yy | Year 00 - 99 |
yyy | Count of years from 1/1/1970, for duration in years. It is accepted also as [y] |
yyyy | Year 0000 - 9999 |
yyyyy | Year of week 0000 - 9999, use with week numbers (ddddddd). It differs from yyyy only in few last days in December. |
h | Hours 1 - 12 |
hh | Hours 01 - 12 |
hhh | Count of hours from 1/1/1970 00:00:00, for duration in hours. It is accepted also as [h] |
hhhh | Tenths of hours empty or 1 |
hhhhh | Hours 1-9, 0-2 |
H | Hours 0 - 23 |
HH | Hours 00 - 23 |
HHH | not used |
HHHH | Tenths of hours empty or 1 |
HHHHH | Hours 0-9, 0-9, 0-3 |
m | Minutes 0 - 59 |
mm | Minutes 00 - 59 |
mmm | Count of minutes from 1/1/1970 00:00:00, for duration in minutes. It is accepted also as [m] |
mmmm | Tenths of minutes 0 - 5 |
mmmmm | Minutes 0 - 9 |
s | Seconds 0 - 59 |
ss | Seconds 00 - 59 |
sss | Count of seconds from 1/1/1970 00:00:00, for duration in seconds. It is accepted also as [s] |
ssss | Tenths of seconds 0 - 5 |
sssss | Seconds 0 - 9 |
f | Hundreds of milliseconds, 0 - 9 |
ff | Tenths of milliseconds 00 - 99 |
fff | Milliseconds - 000 - 999 |
ffff | Tenths of milliseconds 0 - 9 |
fffff | Milliseconds - 0 - 9 |
t | First letter of AM/PM designator, by default A or P as the first character of AMDesignator / PMDesignator. It can be set also by "a/p" or "A/P". |
tt | AM/PM designator, by default AM or PM. It can be set also by "am/pm" or "AM/PM".
The designator is defined in file Texts.js, object Format, attributes AMDesignator and PMDesignator.
|
z | Timezone hours -12, +0, +13 |
zz | Timezone hours -12, +00, +13 |
zzz | Timezone hours and minutes, -12:00, +0:00, +13:00 |
\ | Escape character, the next character is placed to output without any changes. Use to place format characters as d,M,y,...
In JSON all the characters '\' must be doubled. To place the '\' itself, doubled it '\\' (in JSON as '\\\\'). |
'xxx' or "xxx" | Characters in quotes or double quotes are placed to output without any changes. Use to place format characters as d,M,y,... |
% | Place before format when use one character user format like 'd' (=> '%d') to not be taken as standard format. |
; | Separates the format for text as prefix@suffix where @ displays the text or if @ is missing, it displays only the text after the ";".
It separates the formats with conditions. |
[color] | Colors the whole text in given CSS color. |
[condition] |
Uses given part (parts are separated by semicolon) only if the value fulfills the condition.
Condition can be simple as: [=date], [<>date], [<date], [<=date], [>date], [>=date].
Or the condition can be complex JavaScript formula. The formula can use predefined variables d (day), M (month), y (year), w (week day, 0 = Sunday), h (hours), m (minutes), s (seconds), f (milliseconds).
yh (hirji year), Mh (hirji month), dh (hirji day).
For compatibility it can use also "=" and "<>" for comparing.
For example: Format: "[y>2010&&y<2015][blue]d.M.yyyy;[y=2018][red]d.M;d.M.yyyy"
|
[^multi] |
The format can contain more parts (parts are separated by semicolon) to use the part that is suitable for the date according to its missing fractions (e.g. seconds, time or date, etc.)
The part name in the [ ] can consist from some of these letters (always in this order):
e - used to format value for editing,
y - year except current, M - month except current, d - month day except current, h hours except 00, m minutes except 00, s except 00, f milliseconds except 000.
The current year, month and day are compared to DefaultDate or today.
The y, M, d are not set also for 1/1/1970 (ExcelDates = 0) or for 12/31/1899 (ExcelDates = 1).
If the object does not contain attribute for the actual date, the closest attribute is chosen according to the internal algorithm.
For example: "[^yMd]d;[^hms]t;[^ehms]T;[^yMdhms]H" }, for date "1/1/2000" is chosen format "d" from yMd, for date "12:30" is chosen "t" from hms as the closest to hm.
There are also special attributes chosen in special cases:
today - current date without time, yesterday - day before current date without time, tomorrow - day after current date without time,
empty - date is null or empty string, zero - date is 0 as time 00:00:00, error - date is not valid date,
edit - format used to convert string to date, especially for d,M,y order.
|
For example:
Format: 'dddd, MMMM yyyy hh:mm:ss tt' => "Sunday, February 2004 13:24:00"
Or:
Format: '"date:" MM/dd/yyyy", time:" HH:mm" => "date: 10/03/2001, time: 12:34"
Format string for editing the date and / or time.
In this format is displayed the Date or Auto (with date) cell when edited.
It is also used for parsing entered date string if it is ambiguous, e.g. "18/04" can be "dd/MM", "MM/dd" or even "yy/MM".
Empty format
If it is not set, it uses
Format value.
If it is
empty, it accepts all formats like input JSON:
date: yyyy-M-d, M-d, M/d/yyyy, M/d, d.M.yyyy
time: HH:mm, HH:mm:ss, hh.mm, hh.mm.ss, including am/pm, AM/PM, a.m./p.m., A.M./P.M.
If set only time, it cannot be separated by dot.
Standard or user format
Its structure is the same as
Format, but not all formats are possible for input, only number inputs are supported.
If set
StrictDates 3. bit (&4) (default setting), months can be entered also by their name or shortcut. In this case the separators are not required. The month names can be localized in
InputMonthNames.
The format should contains only these parts of custom format: d, dd, DDDD, M, MM, MMM, MMMM, y, yy, yyyy, h, hh, hhh, H, HH, m, mm, mmm, s, ss, sss, t, tt.
All the other unsupported parts of the custom format are removed or converted to supported parts.
The user can use more separators set by
InputDateSeparators,
InputTimeSeparators and
InputDateTimeSeparators.
The am / pm can be localized in
InputAMPMDesignators.
If set
StrictDates 4. bit (&8) (default setting) the user can also enter the date / time without separators, only as number, in formats like HHmm, HHmmss, MMddyy, MMddyyyy, in the order set in the EditFormat.
Value in hours that is added to the cell date value, for display and for editing.
If set to
empty string, it is
local time zone.
All dates in FastGrid are in UTC (GMT). Use TimeZone to display the UTC date in different time zone.
Specific definition of
Calendar dialog shown for Date type cell to pick up the date.
Format bits
StrictDates
[15]
If and how restricts entering incorrect dates, bit array.
1. bit (&
1) - If set, restricts entering incorrect dates by higher or lower values. If
not set, accepts also dates like 14/30/2000 converted to 2/30/2001 or 4/-4/2000 converted to 3/27/2000. It is always set for
Auto type.
2. bit (&
2) - If set, the entered string must contain only date, not any prefix or suffix string. It is always set for
Auto type.
3. bit (&
4) - If set, permits entering month by its name or shortcut.
4. bit (&
8) - If set, permits entering date or time as a number without separators (e.g. "020718" as 2/7/2018),
permits
3 (hmm,mss,dMM,Mdd,yMM,Myy),
4 (hhmm,mmss,ddMM,MMdd,MMyy,yyMM),
5 (hmmss,Mddyy,dMMyy,Myyyy),
6 (hhmmss,MMddyy,ddMMyy,yyMMdd,yyddMM,MMyyyy,yyyyMM),
7 (Mddyyyy,dMMyyyy) and
8 (MMddyyyy,ddMMyyyy,yyyyMMdd,yyyyddMM) digits.
5. bit (&
16) - If set, permits entering elapsed time (hours>23 or minutes/seconds > 59), but the time cannot be set without separators.
6. bit (&
32) - If set, restricts entering single number. It is always set for
Auto type.
Format int
DateFormatLowercase
[1]
If set, the months can be set also by 'm' and 24hour hours also by 'h' in the
Format string.
The 'm' as month is identified if the format contains d or D or y and does not contain h or H or M.
The 'h' as 24hour hour is identified if the format does not contain t or tt.
If set to
2, it also converts the whole Format to lower case before used.
Grid method string
DateToString
(any date, string format = "", int range = 0, bits type = 0, any default = null, number zone = 0)
Converts
date to string according to
format string like
Format attribute.
date can number or string like date value in
V / Value.
If set
range, the
date can be range string with dates, it is converted to range string with the individual dates formatted.
For
range =
2 uses
ValueSeparatorDisplay and
RangeSeparatorDisplay.
type controls the conversion, bit array:
1.bit &
1 - formates slightly differently to use the result for editing.
2.bit &
2 - does not return NaN for strings even if the format does not contain "
@" part, used for
Auto type.
3.bit &
4 - returns one
NaN for error in range. If not set, replaces by
NaN only the incorrect date(s) in the range.
default is default date (permitted formats are the same as for
date) to be checked for multi format
[^xxxx]. If not set, today 00:00:00 is used.
zone is time zone in hours to be added to the
date.
Grid method number
StringToDate
(string string, string format = "", bits range = 0, bits type = 0, any default = null)
Converts
string to date number using
format string like
Format attribute.
For
ExcelDates =
0 returns date as number of milliseconds since 1/1/1970 and for
ExcelDates =
1 returns date as number of days since 12/31/1899.
For
range =
0 the string can contain only one date. For date ranges it returns NaN. Otherwise the
range can be bit array:
1. bit &
1 - returns parsed date range in string.
2. bit &
2 - uses
ValueSeparatorDisplay and
RangeSeparatorDisplay
3. bit &
4 - returns two dymensional array of dates as number of milliseconds [[d11,d12],[d21,d22],...].
4. bit &
8 - sorts the range by the first date ascending, joins the adjacent ranges and removes duplicities.
type controls the conversion, bit array:
1.bit &
1 - converts strictly, sets
StrictDates bits 1, 2 and 5 (1+2+32).
2.bit &
2 - does not accept decimal number as date, depending on decimal, date and time separators.
3.bit &
4 - returns NaN for error in range. If not set, replaces by NaN only the incorrect dates(s) in the range.
4.bit &
8 - does not convert the output dates to
ExcelDates if set.
5.bit &
16 - accepts input dates also as number of milliseconds (or days for
ExcelDates).
default is default date (permitted formats are like date value in
V / Value) to be checked used for missing date parts in the
string. If not set, today 00:00:00 is used.
Localization
The default date format and setting are specified in
Texts.js, in
Format object.
The default settings is for
English language, changing the
Format object attributes you can easily localize it to another language.
Format string[]
ShortDayNames
The week day short names, starting Sunday, used for the format "ddd"
Default is "Sun,Mon,Tue,Wed,Thu,Fri,Sat"
Format string[]
LongDayNames
The week day full names, starting Sunday, used for the format "dddd"
Default is "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"
Format string[]
Day1CharNames
The week day one character names, starting Sunday, used for the format "ddddd"
Default is "S,M,T,W,T,F,S"
Format string[]
Day2CharNames
The week day calendar names, starting Sunday, used in calendar.
Default is "Su,Mo,Tu,We,Th,Fr,Sa"
Format string[]
DayNumbers
The month day numbers 1 - 31, used for the format "dddddd"
Default is "1st,2nd,3rd,4th,5th,6th,7th,8th,9th,10th,11th,12th,13th,14th,15th,16th,17th,18th,19th,20th,21st,22nd,23rd,24th,25th,26th,27th,28th,29th,30th,31st"
Format string[]
ShortMonthNames
The month short names, starting January, used for the format "MMM"
Default is "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec"
Format string[]
LongMonthNames
The month full names, starting January, used for the format "MMMM" and also in calendar
These names are expected for month name
with day, like 20th January 2000.
Default is "January,February,March,April,May,June,July,August,September,October,November,December"
Format string[]
LongMonthNames2
The month full names, starting January, used for the format "MMMMMMM"
These names are expected for month name
without day, like January 2000.
Default is "January,February,March,April,May,June,July,August,September,October,November,December"
Format any
InputMonthNames
[...]
The month names or shortcuts used for entering the month name, starting January, used for
StrictDates &
4. Case insensitive.
It can contain 12, 24, 36, 48, etc. month names, defined in 12 item sets like "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec,Ja,Fe,Ma,Ap,Ma,Jn,Jl,Au,Se,Oc,No,De".
Default is empty to use
ShortMonthNames,
LongMonthNames and
LongMonthNames2 for entering month names.
Format string[]
Quarters
The year quarter names or numbers, used for the format "MMMMM"
Default is "I,II,III,IV"
Format string[]
Halves
The year half names or numbers, used for the format "MMMMMM"
Default is "I,II"
Format string
CalendarMonth
["MMMMMMM yyyy"]
Format to display month and year in calendar header.
Format char
DateSeparator
["/"]
The string displayed in place of '/' in the format string. It is intended to separate date parts.
Format string
InputDateSeparators
["/.-"]
The characters accepted as date separator while editing. Should not contain any character from
InputTimeSeparators
Format char
TimeSeparator
[":"]
The string displayed in place of ':'' in the format string. It is intended to separate time parts.
Format string
InputTimeSeparators
[":"]
The characters accepted as time separator while editing. Should not contain any character from
InputDateSeparators
Format string
InputDateTimeSeparators
[...]
The characters accepted as separator between date and time while editing. Case insensitive.
Default is any character except digits and
InputTimeSeparators and
InputDateSeparators, but nothing added to accepted characters for editing Date.
Format string
AMDesignator
["AM"]
The string displayed for dates before noon. It is used only for display.
Format string
PMDesignator
["PM"]
The string displayed for dates after noon. It is used only for display.
Format string[]
InputAMPMDesignators
[...]
AM and PM designator names used accepted for editing. Case insensitive.
It can contain more names defined like "am,pm,a,p,a.m,p.m".
Default is AMDesignator,PMDesignator and also their first character.
Format int
FirstWeekDay
[0]
The starting day of the week, the 0 is Sunday, 1 Monday, ....
It is used by Calendar dialog.
Format int
FirstWeekYearDay
[0]
The first day in week (always from Sunday) to be the week marked as the first week in year.
Set it to
0 for U.S. week numbering and to
3 for ISO/European week numbering.
Set
FirstWeekDay accordingly, for standard behavior you should use FirstWeekDay=0 for U.S. numbering and 1 for ISO numbering.
Format string
NaD
["Date error!"]
The string displayed for incorrect date for display.
Format string
NaDRange
["Date range error!"]
The string displayed for incorrect date range for display if set
RangeError &
1.
Format string
NaDInput
["e"]
The string displayed for incorrect date or date range for editing.
Format string
NaDFormat
["[red]@"]
Date
Format to display the
NaD and
NaDRange. By default it colors the text red.
Calendar
Date picker dialog done by popup FastGrid defined in
Calendar.js.
To show the
Calendar on click to icon set
LeftIcons
or
RightIcons or
TextIcons = "
Date". The Date icon is hidden for not editable cells (see
NoEdit).
To show the
Calendar on click to the whole cell set
Button="
Date". It will restrict inline editing of the cell. The calendar dialog is not shown for not editable cell (see
NoEdit).
Calendar JSON definition defines its parameters in
Script tag, especially date in
Script.Dates. The calendar position is defined in
Place tag.
The JSON calendar can contain also the same tags as the FastGrid JSON like Cfg or Colors.
Calendar derives
FastGrid JSON dialog.
These calendar settings for row / column / cell can be set by
Calendar attribute.
To preset some attribute in default calendar in grid, set it like
Dialogs: { Calendar: { Script: { Add:2 } } }
Script string
Dates
Initially selected date(s) in the calendar as one date or date ranges string.
The date(s) can be set as number of milliseconds (
ExcelDates = 0) or number of days (
ExcelDates = 1) or by date string in format "M/d/yyyy HH:mm:ss" or "yyyy-M-d HH:mm:ss".
The ranges are separated by
RangeSeparator and
ValueSeparator.
Script string
Date
Date (used only month and year) shown in the most left calendar on start.
If not set, the first
Dates are shown.
The date(s) can be set as number of milliseconds (
ExcelDates = 0) or number of days (
ExcelDates = 1) or by date string in format "M/d/yyyy HH:mm:ss" or "yyyy-M-d HH:mm:ss".
Script int
Range
[0]
How many dates can be chosen:
0 - single date,
1 - more ranges,
2 - more single dates,
3 - one range.
Script int
Add
[0]
If and how dates are added to the
Range calendar by default left click.
0 - left click clears previously selected dates.
1 - left click adds date range - reverses left click and shift + click.
2 - left click adds single dates - reverses left click and right click / ctrl + click.
Script int
Months
[1/2]
Number of months (calendars) shown, default (for null) is
1 for
Range = 0 and
2 for
Range > 0.
Script string[]
Buttons
["" / "Ok,Clear"]
Which buttons will be shown on bottom toolbar, it can be comma separated string or array of the button ids. It controls also the button order.
Available buttons: "
Ok" - save changes and close calendar, "
Cancel" - close calendar without saving changes, "
Clear" - clear all the selected dates, "
Today" - choose today's date and close calendar.
Default is "" for
Range = 0 and "Ok,Clear" for Range > 0.
Script int
ButtonsAlign
[2]
Horizontal alignment of the buttons,
0 - left,
1 - right,
2 - center.
Script bool
WeekNumbers
[1]
If set, shows week numbers in the left column in every month calendar.
Script int
Clear
[2]
If the clear icon is shown in the top left corner of every month calendar, only for
WeekNumbers =
1. For
2 the clear icon supports also select all for
Range.
Script string
Today
[1]
If set to
1, today's date is marked in the calendar.
It can be set also to date string to mark this date instead of today.
Script bool
MonthEdit
[1]
If set, month and year in the first row can be chosen from list. Otherwise the month and year is displayed readonly according to
MonthFormat.
Script string
MonthFormat
["lm"]
Date format string to display month and year in the first row. Only for
MonthEdit =
0.
Script int
Time
[0]
If shows time in bottom toolbar, left to
Buttons,
0 - no,
1 - edit whole time in edit box,
2 - select time from select boxes, hour, minute and second.
Script int
TimeRound
[1]
How to round the last time units set in
TimeFormat, value can be 1, 2, 3, 4, 5, 6, 10, 15, 20, 30 for minutes / seconds or 1, 2, 3, 4, 6, 12 for hours.
For example TimeFormat='15' for TimeFormat="hh:mm" rounds the displayed times to hh:00, hh:15, hh:30, hh:45.
Script string
TimeFormat
["HH:mm:ss"]
Date format string to display and edit time (
Time =
1). Affects also select time (
Time =
2), but just by presenting HH, HH:mm or HH:mm:ss.
Script int
TimeAlign
[0]
Horizontal alignment of the time cell in bottom toolbar,
0 - left,
1 - right,
2 - center.
Script string
FirstDate
["1/1/2000"]
Minimal date (in string "M/d/yyyy" or "yyyy-M-d" or as number of milliseconds) that can be shown or chosen in the calendar.
Script string
LastDate
["12/31/2030"]
Maximal date (in string "M/d/yyyy" or "yyyy-M-d" or as number of milliseconds) that can be shown or chosen in the calendar.
Script string
Background
["w#1/7/2023~1/9/2023#calweekend"]
Colors given dates, but does not exclude them. By default colors weekends.
The ranges are separated by semicolon, the values by tilde and the repeater and color by '#'.
The format is:
repeater1#date1a~date1b#color1;repeater2#date2a~date2b#color2;...
The
repeater repeats given
date range, it can be one of units:
'
ms' - milliseconds, "
ms10" - 10 milliseconds, "
ms100" - 100 milliseconds,
'
s' - seconds, '
s2' - 2 seconds, '
s5' - 5 seconds, '
s10' - 10 seconds, '
s15' - 15 seconds, '
s30' - 30 seconds,
'
m' - minutes, '
m2' - 2 minutes, '
m5' - 5 minutes, '
m10' - 10 minutes, '
m15' - quarters of hour, '
m30' - halves of hour,
'
h' - hours, '
h2' - 2 hours, '
h3' - 3 hours, '
h6' - quarters of day, '
h8' - thirds of day, '
h12' - halves of day,
'
d' - days, '
w' - weeks (starting by
FirstWeekDay), '
w0' - weeks (starting by Sunday), '
w1' - weeks (starting by Monday), '
w6' - weeks (starting by Saturday),
'
M' - months, '
M2' -
(new 10.0) two months, '
M3' - quarters of year, '
M4' -
(new 10.0) four months, '
M6' - halves of year,
'
y' - years, '
y2' - 2 years, '
y3' - 3 years, '
y4' - 4 years, '
y5' - 5 years, '
y10' - 10 years, '
y20' - 20 years, '
y50' - 50 years
(2-50 year is new 10.0)
If
repeater is missing, the
date is not repeated and specifies one exact range.
Script string
Exclude
Excludes and colors given dates, these dates cannot be selected. Format is the same as in
Background.
For example to exclude weekends set Exclude:
"w#1/7/2023~1/9/2023#calweekend".
Script bool
RemoveExclude
[1]
If set, removes
Exclude dates from inside of selected ranges in
Dates.
Script int
UpdateParent
[1]
If set, updates the
Parent grid source cell, if shown as dialog for grid cell.
If set to
2, it updates the parent grid source cell in Filter row or column and refilters the grid.
Maximal count of excluded units.
Actions
ShowCalendar
(int target = 0)
OnClickDate
Shows calendar for actual or focused cell, defined in
Calendar attribute.
Grid method object
ShowCalendar
(Row row, Col col)
Shows calendar for the cell
row,
col, defined in
Calendar attribute.
Returns the created FastGrid object.
If the cell already shown the calendar, it closes the calendar and returns false.
Returns null if fails.
API event bool
OnShowCalendar
(Grid grid, Row row, Col col, Dialog calendar)
Called before showed
calendar for cell
row,
col.
calendar is the JSON
Calendar object with Script.Dates and Place.
Return true to not display the calendar.
API event void
OnShowedCalendar
(Grid grid, Row row, Col col, Grid calendargrid)
Called after the calendar was shown for given cell.
calendargrid is grid displayed with the calendar cells.