Constructor
Methods
(static) currYear():Number
Returns the current year (in four digit format).
Returns
- Type
- :Number
Source: Datelish.js, line 103
(static) dateIsAfter(date, isAfterDate):Boolean
Returns a boolean determining whether a given date is after a date.
Parameters
date:Date
The date to check against.
isAfterDate:Date
The date to compare against.
Returns
- Type
- :Boolean
Source: Datelish.js, line 157
(static) dateIsBefore(date, isBeforeDate):Boolean
Returns a boolean determining whether given date is before a date.
Parameters
date:Date
The date to check against.
isBeforeDate:Date
The date to compare against.
Returns
- Type
- :Boolean
Source: Datelish.js, line 167
(static) dateIsBetween(date, startDate, endDate, includeEndDateopt):Boolean
Returns a boolean determining whether a given date is between two dates.
Parameters
date:Date
The date to check against.
startDate:Date
The start date.
endDate:Date
The end date.
includeEndDate:Boolean
= false
(optional)
Whether to include the end date.
Returns
- Type
- :Boolean
Source: Datelish.js, line 147
(static) dayCount(startDate, endDate):Number
Returns the number of days between two dates.
Parameters
startDate:Date
The start date.
endDate:Date
The end date.
Returns
- Type
- :Number
Source: Datelish.js, line 376
(static) daysFromDate(date, n):Date
Returns a number of days before/after a given date.
Parameters
date:Date
The date to check against.
n:Number
The number of days to advance/retract. Use a negative number to go back days.
Returns
- Type
- :Date
Source: Datelish.js, line 331
(static) daysPerMonth(month, year):Array
Returns an array of days for a given month of the specified year. Including the year is requied since
days change due to leap year.
Parameters
month:Number|String
Expects either a number representing the current month (0-11) or
a string with the month name (as either a three letter abbreviation
or the full name in American English).
year:Number
Can be formatted as either two digits or four digits.
Returns
- Type
- :Array
Source: Datelish.js, line 35
(static) daysTotal(month, year):Number
Returns the total numbers of days in a given month of the specified year. Including the year is requied since
days change due to leap year.
Parameters
month:Number|String
Either a number representing the current month (0-11) or a string
with the month name (as either a three letter abbreviation or the full
name in American English).
year:Number
Can be formatted as either two digits or four digits.
Returns
- Type
- :Number
Source: Datelish.js, line 56
(static) fromBigEndian(dateStr):Date
Returns a date from a big-endian formatted string (YYYY/MM/DD).
Parameters
dateStr:String
The date to check against.
Returns
- Type
- :Date
Source: Datelish.js, line 264
(static) fromLittleEndian(dateStr):Date
Returns a date from a little-endian formatted string (DD/MM/YYYY).
Parameters
dateStr:String
The date to check against.
Returns
- Type
- :Date
Source: Datelish.js, line 204
(static) fromMiddleEndian(dateStr):Date
Returns a date from a middle-endian formatted string (MM/DD/YYYY).
Parameters
dateStr:String
The date to check against.
Returns
- Type
- :Date
Source: Datelish.js, line 234
(static) monthAsNames(short):Array
Returns an array of month names.
Parameters
short:Boolean
= false
Whether to return full month names or the 3 letter abbreviated versions.
Returns
- Type
- :Array
Source: Datelish.js, line 18
(static) monthIndexToName(index, shortopt):String
Returns the name for a given month index (0–11).
Parameters
index:Number
The index to search.
short:Boolean
= false
(optional)
Whether to return full a month name or the 3 letter abbreviated version.
Returns
- Type
- :String
Source: Datelish.js, line 124
(static) monthNameToIndex(month):Number
Returns the index (0–11) for a given month.
Parameters
month:String
The month name (as either a three letter abbreviation or the full name in American English).
Returns
- Type
- :Number
Source: Datelish.js, line 112
(static) monthsFrom(startDate, endDate):Array
Returns an array of months from the given dates.
Parameters
startDate:Date
The start date.
endDate:Date
The end date.
Returns
- Type
- :Array
Source: Datelish.js, line 388
(static) now():Date
Returns the today including the current time.
Returns
- Type
- :Date
Source: Datelish.js, line 295
(static) prepend0(val):String
Returns a string with a prepended "0" (if the value is less than 10).
Parameters
val:Number|String
The string/number to check against.
Returns
- Type
- :String
Source: Datelish.js, line 360
(static) prevMonth():Date
Returns the previous month.
Returns
- Type
- :Date
Source: Datelish.js, line 339
(static) toBigEndian(date, divideropt, prepend0opt):String
Returns a date in big-endian format (YYYY/MM/DD).
Parameters
date:Date
The date to check against.
divider:String
= "/"
(optional)
The character to use as a divider.
prepend0:Boolean
= true
(optional)
Whether to prepend a "0" if the value is less than the 10.
Returns
- Type
- :String
Source: Datelish.js, line 251
(static) todayIs(date):Boolean
Returns a boolean determining whether a given date is today.
Parameters
date:Date
The date to check against.
Returns
- Type
- :Boolean
Source: Datelish.js, line 133
(static) toISO8601(date):String
Returns a date in ISO 8601 format (YYYY-MM-DDThh:mm:ssTZD).
Parameters
date:Date
The date to check against.
Returns
- Type
- :String
Source: Datelish.js, line 176
(static) toLittleEndian(date, divideropt, prepend0opt):String
Returns a date in little-endian format (DD/MM/YYYY).
Parameters
date:Date
The date to check against.
divider:String
= "/"
(optional)
The character to use as a divider.
prepend0:Boolean
= true
(optional)
Whether to prepend a "0" if the value is less than the 10.
Returns
- Type
- :String
Source: Datelish.js, line 191
(static) toMiddleEndian(date, divideropt, prepend0opt):String
Returns a date in middle-endian format (MM-DD-YYYY).
Parameters
date:Date
The date to check against.
divider:String
= "/"
(optional)
The character to use as a divider.
prepend0:Boolean
= true
(optional)
Whether to prepend a "0" if the value is less than the 10.
Returns
- Type
- :String
Source: Datelish.js, line 221
(static) toMinutes(sec, prepend0opt):String
Converts seconds to minutes.
Parameters
sec:Number
Seconds.
prepend0:Boolean
= true
(optional)
Whether to prepend a "0" if the value is less than the 10.
Returns
- Type
- :String
Source: Datelish.js, line 280
(static) years(from, to):Array
Returns an array of years (in four digit format) from the range inputted.
Parameters
from:Number
A four digit year.
to:Number|String
A number or string. If a string is used, a range is returned with
the 'from' year plus amount in the 'to' string. For example: Assuming
the current year is 2012, both Datelish.years(Datelish.currYear, 2014)
and Datelish.years(Datelish.currYear, "2") return [2012, 2013, 2014].
Returns
- Type
- :Array
Source: Datelish.js, line 77