SimileAjax/Units

From SIMILE Widgets
Jump to: navigation, search

Contents

SimileAjax Units

There is no SimileAjax.Units namespace, there is instead a NativeDateUnit object that provides some convenience functions for dealing with the native Date type provided by Javascript.

Code: http://api.simile-widgets.org/ajax/2.2.1/scripts/units.js

Back to SimileAjax.

Methods

SimileAjax.NativeDateUnit.makeDefaultValue

Arguments: None
Returns: Date
Description: Returns a native Date object representing now.

SimileAjax.NativeDateUnit.cloneValue

Arguments:
v: Date
Returns: Date
Description: Creates a new object with the same value as an existing Date object.

SimileAjax.NativeDateUnit.getParser

Arguments:
format: string, One of "iso8601", "iso 8601", or anything else
Returns: function
Description: Returns a function capable of parsing the format described; anything other than ISO8601 will be treated as a Gregorian date.

SimileAjax.NativeDateUnit.parseFromObject

Arguments:
o: object
Returns: Date
Description: Passes through to Gregorian parser

SimileAjax.NativeDateUnit.toNumber

Arguments:
v: Date
Returns: int
Description: Gets value of date in seconds from epoch

SimileAjax.NativeDateUnit.fromNumber

Arguments:
n: int
Returns: Date
Description: Returns Date given seconds from epoch

SimileAjax.NativeDateUnit.compare

Arguments:
v1: Date or float
v2: Date or float
Returns: int or float, negative if v1 is less than v2, 0 if equal, positive if v1 is greater than v2
Description: Compares dates, returning values binned to negative, 0, and positive accordingly

SimileAjax.NativeDateUnit.earlier

Arguments:
v1: Date or float
v2: Date or float
Returns: boolean, true if v1 is absolutely earlier than v2, false otherwise
Description: Passes through to comparison method above.

SimileAjax.NativeDateUnit.later

Arguments:
v1: Date or float
v2: Date or float
Returns: boolean, true if v1 is absolutely later than v2, false otherwise
Description: Passes through to comparison method above.

SimileAjax.NativeDateUnit.change

Arguments:
v: Date
n: int
Returns: Date
Description: Increments the date v by the number of seconds n.

Back to SimileAjax.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox