Project Outline
«
pulp javascript framework

Class pulp.date

Defined in: pulp.date.js.

Constructor
^ top
new pulp.date(DateObj)
Wrapper class for Date objects
  var $D = pulp.date.getInstance;
  $D('2009-08-15 08:03:00').add(1, 'month').strftime('%m/%d/%Y'); // 09/15/2009
Parameters:
DateObj
Requires:
base
Method Summary
^ top
add(number, unit) (chainable) Add an arbitrary amount to the currently stored date
diff(dateObj, unit, allowDecimal) Find the difference between the current and another date
getShortYear() Return a proper two-digit year integer
getMonthNumber() Get the number of the current month, 1-12
getMonthName() Get the name of the current month
getAbbrMonthName() Get the abbreviated name of the current month
getDayName() Get the name of the current week day
getAbbrDayName() Get the abbreviated name of the current week day
getDayOrdinal() Get the ordinal string associated with the day of the month (i.e.
getHours12() Get the current hour on a 12-hour scheme
getAmPm() Get the AM or PM for the current time
getUnix() Get the current date as a Unix timestamp
getGmtOffset() Get the GMT offset in hours and minutes (e.g.
getTimezoneName() Get the browser-reported name for the current timezone (e.g.
toYmdInt() Convert the current date to an 8-digit integer (%Y%m%d)
clone() Create a copy of a date object
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.
UTC(Y, M, D [, H=0] [, i=0] [, s=0]) Wrapper for Date.UTC()
daysInMonth(year, month) Get the number of days in the given month
addFormatter(name, defaultFormat)
_zeroPad(number, digits) Add leading zeros
Field Detail
^ top
raw
The raw Date object

									
								
									
										
										
										
										
				
								
pulp.date.MONTHNAMES

									
								
									
										
										
										
										
				
								
pulp.date.ABBR_MONTHNAMES

									
								
									
										
										
										
										
				
								
pulp.date.DAYNAMES

									
								
									
										
										
										
										
				
								
pulp.date.ABBR_DAYNAMES

									
								
									
										
										
										
										
				
								
pulp.date.ORDINALNAMES

									
								
									
										
										
										
										
				
								
pulp.date.ISO

									
								
									
										
										
										
										
				
								
pulp.date.SQL

									
								
									
										
										
										
										
				
								
pulp.date.strftime

									
								
									
										
										
										
										
				
								
pulp.date.patterns

									
								
									
										
										
										
										
				
								
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}
getShortYear() -> Number
Return a proper two-digit year integer

										
									
Returns:
{Number}
getMonthNumber() -> Number
Get the number of the current month, 1-12

										
									
Returns:
{Number}
getMonthName() -> String
Get the name of the current month

										
									
Returns:
{String}
getAbbrMonthName() -> String
Get the abbreviated name of the current month

										
									
Returns:
{String}
getDayName() -> String
Get the name of the current week day

										
									
Returns:
{String}
getAbbrDayName() -> String
Get the abbreviated name of the current week day

										
									
Returns:
{String}
getDayOrdinal() -> String
Get the ordinal string associated with the day of the month (i.e. st, nd, rd, th)

										
									
Returns:
{String}
getHours12() -> Number
Get the current hour on a 12-hour scheme

										
									
Returns:
{Number}
getAmPm() -> String
Get the AM or PM for the current time

										
									
Returns:
{String}
getUnix() -> Number
Get the current date as a Unix timestamp

										
									
Returns:
{Number}
getGmtOffset() -> String
Get the GMT offset in hours and minutes (e.g. +06:30)

										
									
Returns:
{String}
getTimezoneName() -> String
Get the browser-reported name for the current timezone (e.g. MDT, Mountain Daylight Time)

										
									
Returns:
{String}
toYmdInt() -> Number
Convert the current date to an 8-digit integer (%Y%m%d)

										
									
Returns:
{Number}
clone() -> pulp.date
Create a copy of a date object

										
									
Returns:
{pulp.date}
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
pulp.date.addFormatter(name, defaultFormat)

										
									
Parameters:
{String} name The name of the formatter function on pulp.date
{String} defaultFormat The format to use if none is given
Returns:
pulp.date._zeroPad(number, digits) -> String
Add leading zeros

										
									
Parameters:
{Number} number The number to which to prepend zeros
{Number} digits The total length to output
Returns:
{String}
Documentation generated by JsDoc Toolkit 2.1.0 on Tue Aug 18 2009 22:40:27; Template based on jProton by Pedro Simonetti