- Source:
Date-based type functionality.
Methods
[mixin]
ish.type.date.age(x) → {integer}
- Source:
Determines the full years since the passed value.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Description |
x |
variant
|
Value representing the date of birth. |
Returns:
Type |
Description |
integer
|
Value representing the full years since the passed value. |
[mixin]
ish.type.date.cmp(x, vRelativeToopt) → {integer}
- Source:
Compares the passed value to the reference value, determining if it is greater then, less then or equal.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
x |
variant
|
|
|
Value representing the date to compare. |
vRelativeTo |
variant
|
<optional>
|
new Date()
|
Value representing the relative date to compare to. |
Returns:
Type |
Description |
integer
|
Value representing if the passed value is greater then (1 ), less then (-1 ) or equal to (0 ) the passed relative value with undefined indicating one of the passed values was not a reconized date. |
[mixin]
ish.type.date.cp(x) → {date}
- Source:
Copies the passed value into a new instance.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Description |
x |
variant
|
Value representing the date to copy. |
Returns:
Type |
Description |
date
|
Value representing the passed value as a new instance. |
[mixin]
ish.type.date.dayOfYear(vDateTime) → {string}
- Source:
Determines the day of the year of the passed value.
From Mixin: ish.type.date-format.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Description |
vDateTime |
variant
|
Value to interrogate. |
Returns:
Type |
Description |
string
|
Value representing the day of the year of the passed value. |
[mixin]
ish.type.date.diff(x, yopt, eUnitOfTimeopt) → {integer}
- Source:
Determines the difference between two dates.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
x |
variant
|
|
|
Value representing the first date to compare. |
y |
variant
|
<optional>
|
new Date()
|
Value representing the second date to compare. |
eUnitOfTime |
string
|
<optional>
|
"d"
|
Value representing the unit of time to return; s seconds, m minutes, h hours, d days, w weeks, M months, Y years. |
Returns:
Type |
Description |
integer
|
Value representing the difference between two dates. |
[mixin]
ish.type.date.enums()
- Source:
Enumerations for Days (ish.type.date.enum.days
) and Week of Year (ish.type.date.enum.weekOfYear
).
From Mixin: ish.type.date-format.js
must be included for ishJS
to access this functionality.
[mixin]
ish.type.date.eq(x, y) → {boolean}
- Source:
- See:
-
Determines if the passed values are equal.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Description |
x |
variant
|
Value to interrogate. |
y |
variant
|
Value to interrogate. |
Returns:
Type |
Description |
boolean
|
Value representing if the passed values are equal. |
- Source:
Formats the passed value based on the passed format.
From Mixin: ish.type.date-format.js
must be included for ishJS
to access this functionality.
Note: The date format is specified using the following values:
D
: Day of Month as numberDD
: Day of Month as 2-digit number (zero-padded)S
: Day of Month's One's Place Suffix (e.g. st
, nd
, rd
, th
).
W
: Day of Week as 1-character (e.g. M
)WWW
: Day of Week as 3-characters (e.g. Mon
)WWWW
: Day of Week as word (e.g. Monday
)
M
: Month as numberMM
: Month as 2-digit number (zero-padded)MMM
: Month as 3-characters (e.g. Jan
)MMMM
: Month as word (e.g. January
)
w
: Week of Year's Week as numberww
: Week of Year's Week as 2-digit number (zero-padded)yy
: Week of Year's Year as 2-digit numberyyyy
: Week of Year's Year as 4-digit number
YY
: Year as 2-digit number (zero-padded)YYYY
: Year as 4-digit number
J
: Day of Year as numberJJJ
: Day of Year as 3-digit number (zero-padded)
E
: Timestamp as numbere
: window.performance
-based Timestamp as number
H
: 24 Hour as numberHH
: 24 Hour as 2-digit number (zero-padded)
h
: 12 Hour as numberhh
: 12 Hour as 2-digit number (zero-padded)
m
: Minutes as numbermm
: Minutes as 2-digit number (zero-padded)
s
: Seconds as numberss
: Seconds as 2-digit number (zero-padded)
t
: Meridian as 1-character (e.g. a
, p
)tt
: Meridian as 2-characters (e.g. am
, pm
)
zz
: Timezone Offset in Minutes as number (per MDN)zzzz
: Timezone Offset as ±hh:mm
(e.g. -08:00
, per MDN)
Parameters:
Name |
Type |
Description |
vDateTime |
variant
|
Value to interrogate. |
sFormat |
string
|
Value representing the date format. |
Returns:
Type |
Description |
string
|
Value representing the formatted date. |
ish.type.date.is(x, vOptionsopt) → {boolean}
- Source:
Determines if the passed value represents a date.
Parameters:
Name |
Type |
Attributes |
Description |
x |
variant
|
|
Value to interrogate. |
vOptions |
boolean
|
object
|
<optional>
|
Value representing if numeric values are to be ignored or the following options:
Properties
Name |
Type |
Attributes |
Default |
Description |
allowNumeric |
boolean
|
<optional>
|
false
|
Value representing if numeric values are to be ignored. |
strict |
boolean
|
<optional>
|
false
|
Value representing if only [object Date] are to be allowed. |
|
Returns:
Type |
Description |
boolean
|
Value representing if the passed value represents a date. |
[mixin]
ish.type.date.isoLocalString(vDateTime) → {string}
- Source:
- See:
-
Formats the passed value in ISO 8601 format with the local timezone offset.
From Mixin: ish.type.date-format.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Description |
vDateTime |
variant
|
Value to interrogate. |
Returns:
Type |
Description |
string
|
Value representing the passed value in ISO 8601 format with the local timezone offset. |
[mixin]
ish.type.date.lastDayOfMonth(xopt, iYearopt) → {integer}
- Source:
Determines the last day of the month for the passed values.
From Mixin: ish.type.date-format.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
x |
date
|
integer
|
<optional>
|
new Date().getMonth() + 1
|
Value representing the date to interrogate or the month as a 1-based number (e.g. January = 1 ). |
iYear |
integer
|
<optional>
|
new Date().getFullYear()
|
Value representing the year as a 4-digit number (e.g. 1970 ). |
Returns:
Type |
Description |
integer
|
Value representing the last day of the month for the passed values. |
[mixin]
ish.type.date.leapYear(xopt) → {integer}
- Source:
Determines if the year is a leap year.
From Mixin: ish.type.date-format.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
x |
date
|
integer
|
<optional>
|
new Date()
|
Value representing the date to interrogate or the year as a 4-digit number (e.g. 1970 ). |
Returns:
Type |
Description |
integer
|
Value representing if the year is a leap year. |
ish.type.date.mk(x, vDefaultValopt) → {Date}
- Source:
Casts the passed value into a date.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
x |
variant
|
|
|
Value to interrogate. |
vDefaultVal |
variant
|
<optional>
|
new Date()
|
Value representing the default return value if casting fails. |
Returns:
Type |
Description |
Date
|
Value representing the passed value as a date type. |
[mixin]
ish.type.date.only(xopt, vDefaultopt) → {integer}
- Source:
Determines the date part only of the passed value.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
x |
variant
|
<optional>
|
new Date()
|
Value representing the date. |
vDefault |
variant
|
<optional>
|
|
Value representing the default return value if casting fails. |
Returns:
Type |
Description |
integer
|
Value representing the date part only of the passed value. |
ish.type.date.time.is(x) → {boolean}
- Source:
Determines if the passed value is a time string.
Parameters:
Name |
Type |
Description |
x |
variant
|
Value to interrogate. |
Returns:
Type |
Description |
boolean
|
Value representing if the passed value is a time string. |
ish.type.date.time.mk(x, vDefaultValopt) → {string}
- Source:
- See:
-
Casts the passed value into a time string.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
x |
variant
|
|
|
Value to interrogate. |
vDefaultVal |
variant
|
<optional>
|
'00:00:00.0'
|
Value representing the default return value if casting fails. |
Returns:
Type |
Description |
string
|
Value representing the passed value as a time string. |
ish.type.date.time.seconds(xopt) → {boolean}
- Source:
Determines the number of seconds from midnight the time string represents.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
x |
variant
|
<optional>
|
new Date()
|
Value to interrogate. |
Returns:
Type |
Description |
boolean
|
Value representing the number of seconds from midnight the time string represents. |
ish.type.date.timestamp(bWholeSecondsopt) → {float}
- Source:
Provides the current window.performance
-based timestamp.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
bWholeSeconds |
boolean
|
<optional>
|
false
|
Value representing if the return value is to include fractional seconds. |
Returns:
Type |
Description |
float
|
Value representing the current window.performance -based timestamp. |
[mixin]
ish.type.date.utcToLocalOffset(xopt) → {integer}
- Source:
Resets the datetime offset of the passed value to the local system's datetime offset.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
x |
variant
|
<optional>
|
new Date()
|
Value representing the date. |
Returns:
Type |
Description |
integer
|
Value representing the passed value reset to the local system's datetime offset. |
[mixin]
ish.type.date.weekOfYear(vDateTime) → {string}
- Source:
Determines the week of the year of the passed value.
From Mixin: ish.type.date-format.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Description |
vDateTime |
variant
|
Value to interrogate. |
Returns:
Type |
Description |
string
|
Value representing the week of the year of the passed value. |
ish.type.date.yyyymmdd(xopt, vDefaultopt, sDelimiteropt) → {integer}
- Source:
Determines the date of the passed value formatted as YYYY/MM/DD
.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
x |
variant
|
<optional>
|
new Date()
|
Value representing the date. |
vDefault |
variant
|
<optional>
|
|
Value representing the default return value if casting fails. |
sDelimiter |
string
|
<optional>
|
"/"
|
Value representing the date delimiter. |
Returns:
Type |
Description |
integer
|
Value representing the passed value formatted as YYYY/MM/DD . |