Namespace: date

core. date

The core.date package is a modular JavaScript library that provides extra Date methods.

Author:
License:

Members


<constant> ONE_DAY_MS :number

Constant field representing one day, in milliseconds.

Type:
  • number
Default Value:
  • 86400000

Methods


after(date1, date2)

Indicates if the first date is after the second date.

Parameters:
Name Type Description
date1 Date

The first date to evaluates.

date2 Date

The second date to evaluates.

Throws:

TypeError The two date arguments must be a valid Date object.

Returns:

true if the first date is after the second date.

Example
trace( after(new Date(2017,0,1),new Date(2016,0,1)) ) ; // true

after(date1, date2)

Indicates if the first date is before the second date.

Parameters:
Name Type Description
date1 Date

The first date to evaluates.

date2 Date

The second date to evaluates.

Throws:

TypeError The two date arguments must be a valid Date object.

Returns:

true if the first date is before the second date.

Example
trace( before(new Date(2016,0,1),new Date(2017,0,1)) ) ; // true

daysInMonth( [date])

Returns the numbers of days in a specified month.

Parameters:
Name Type Argument Description
date Date <optional>

The date (or now) to search the number of days in a month.

Returns:

The numbers of days in a specified month.

Example
trace( daysInMonth(new Date(2016,0,1)) ) ; // 31
trace( daysInMonth(new Date(2016,1,1)) ) ; // 29
trace( daysInMonth(new Date(2017,0,1)) ) ; // 31

leapYear(date)

Indicates if the specified date is a leap year (also known as an intercalary year or a bissextile year) .

Parameters:
Name Type Description
date Date | number

The date to evaluates or a number representing the year integer value representing the year (Value from 0 to 99 map to the years 1900 to 1999).

Throws:

TypeError The date argument must be a valid Date object.

Returns:

true if the specified date is a leap year .

Example
trace( leapYear(2016) ) ; // true
trace( leapYear(new Date(2016,0,1)) ) ; // true

trace( leapYear(2017) ) ; // false
trace( leapYear(new Date(2017,0,1)) ) ; // false

yesterday( [date])

The yesterday new Date object.

Parameters:
Name Type Argument Description
date Date <optional>

The date to evaluates. If this argument is ommited the current Date is used.

Returns:

The yesterday new Date object.

Example
trace( yesterday(new Date(2016,1,2)) ) ;