Class pulp.date
Defined in: pulp.date.js.
Constructor
Method Summary
^ top
getInstance(date)
The heart of the date functionality: returns a date object if given a convertable value
parse(d)
Return a JavaScript timestamp given a date string, unix timestamp, Date object, pulp.date object.
addFormatter(name, defaultFormat)
Field Detail
Method Detail
^ top
add(number, unit)
-> Date
Add an arbitrary amount to the currently stored date
Parameters:
| {Number} | number | |
| {String} | unit |
Returns:
| {Date} |
diff(dateObj, unit, allowDecimal)
-> Number
Find the difference between the current and another date
Parameters:
| {String|Date|Number|pulp.date} | dateObj | |
| {String} | unit | |
| {Boolean} | allowDecimal |
Returns:
| {Number} |
getDayOrdinal()
-> String
Get the ordinal string associated with the day of the month (i.e. st, nd, rd, th)
Returns:
| {String} |
getTimezoneName()
-> String
Get the browser-reported name for the current timezone (e.g. MDT, Mountain Daylight Time)
Returns:
| {String} |
pulp.date.getInstance(date)
-> pulp.date|NaN
The heart of the date functionality: returns a date object if given a convertable value
Parameters:
| {String|Date|Number|pulp.date} | date |
Returns:
| {pulp.date|NaN} |
pulp.date.parse(d)
-> pulp.date|NaN
Return a JavaScript timestamp given a date string, unix timestamp, Date object, pulp.date object.
(similar to Date.parse())
Parameters:
| {String|Date|Number|pulp.date} | d |
Returns:
| {pulp.date|NaN} |
pulp.date.UTC(Y, M, D [, H=0] [, i=0] [, s=0])
-> Number
Wrapper for Date.UTC()
Parameters:
| {Number} | Y | Four-digit year |
| {Number} | M | Month 0-11 |
| {Number} | D | Day |
| {Number} | H?, Default: 0 | Hour |
| {Number} | i?, Default: 0 | Minute |
| {Number} | s?, Default: 0 | Second |
Returns:
| {Number} |
pulp.date.daysInMonth(year, month)
-> Number
Get the number of days in the given month
Parameters:
| {Number} | year | Four-digit year |
| {Number} | month | Month number 1-12 |
Returns:
| {Number} | The number of days in the month |