Namespace: _enhanceDate

JTSageDateBox. _enhanceDate

Enhance the date object for easier use.

These are direct extensions to the JavaScript date object

All methods are also chainable, which is not true of some implementations
in a browser.

Source:

Methods


<static> adj(type, amount)

Adjust the date by a relative amount.

Parameters:
Name Type Description
type number

Element to shift, 0 = year, 5 = seconds

amount number

Offset amount, positive or negative

Source:
Returns:

JavaScript date object

Type
object

<static> comp()

Retrieve a numericly comparable representation of the date : YYYYMMDD

Source:
Returns:

Date as an integer

Type
number

<static> copy(adjust, override)

Return a copy of the date, not altering the original

You may specify partial arrays only as deep as the most
precise element you want to adjust or override. Zeros will
not alter that element. Overrides takes precedence over adjustments

Parameters:
Name Type Description
adjust array

[y,m,d,h,i,s,ms] Adjust part of the date

override array

[y,m,d,h,i,s,ms] Override part of the date

Source:
Returns:

JavaScript date object

Type
object

<static> get(type)

Get part of the date

Parameters:
Name Type Description
type number

Element to set, 0 = year, 5 = seconds

Source:
Returns:

Date part

Type
number

<static> get12hr()

Get the hour in 12 hour format - midnight = 12, 13:00 = 1

Source:
Returns:

Hour

Type
number

<static> getArray()

Get the date as an array

Source:
Returns:

[y,m,d,h,i,s]

Type
array

<static> getDWeek(type)

Get the week number.

Types :

  • 0 : Sunday Based
  • 1 : Monday Based
  • 4 : Thursday Based (ISO-8601 standard)
Parameters:
Name Type Description
type number

Type of calculation

Source:
Returns:

Week number

Type
number

<static> getEpoch()

Get the number of seconds since epoch

Source:
Returns:

Seconds

Type
number

<static> getEpochDays()

Get the number of days since epoch

Source:
Returns:

Days

Type
number

<static> iso()

Get an ISO-8601 version of the date : YYYY-MM-DD

Source:
Returns:

ISO-8601 String

Type
string

<static> setD(type, amount)

Set part of the date, chainable

Parameters:
Name Type Description
type number

Element to set, 0 = year, 5 = seconds

amount number

Value to set

Source:
Returns:

JavaScript date object

Type
object

<static> setDWeek(type, number)

Set the week number.

Types :

  • 0 : Sunday Based
  • 1 : Monday Based
  • 4 : Thursday Based (ISO-8601 standard)
Parameters:
Name Type Description
type number

Type of week calculation. Day of week probably

number number

Week number

Source:
Returns:

JavaScript date object

Type
object

<static> setFirstDay(day)

Set date to the first valid day of the current month.

Parameters:
Name Type Description
day number

Day of week. Zero based

Source:
Returns:

JavaScript date object

Type
object