Class baja.RelTime
Extends
baja.Simple.
Represents a baja:RelTime in BajaScript.
RelTime is a Simple type for managing a relative amount of time.
When creating a Simple, always use the 'make' method instead of creating a new Object.
Defined in: obj.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Field Attributes | Field Name and Description |
|---|---|
| <static> |
baja.RelTime.DAY
RelTime instance for a day.
|
| <static> |
baja.RelTime.DEFAULT
Default RelTime instance.
|
| <static> |
baja.RelTime.HOUR
RelTime instance for an hour.
|
| <static> |
baja.RelTime.MILLIS_IN_DAY
Milliseconds in a day (Number).
|
| <static> |
baja.RelTime.MILLIS_IN_HOUR
Milliseconds in an hour (Number).
|
| <static> |
baja.RelTime.MILLIS_IN_MINUTE
Milliseconds in a minute (Number).
|
| <static> |
baja.RelTime.MILLIS_IN_SECOND
Milliseconds in a second (Number).
|
| <static> |
baja.RelTime.MINUTE
RelTime instance for a minute.
|
| <static> |
baja.RelTime.SECOND
RelTime instance for a second.
|
- Fields borrowed from class baja.Value:
- newCopy
- Fields borrowed from class baja.Object:
- equivalent, getIcon
| Method Attributes | Method Name and Description |
|---|---|
|
decodeFromString(str)
Decode a RelTime from a String.
|
|
|
Encode the RelTime to a String.
|
|
|
equals(obj)
Equality test.
|
|
|
Return the data type symbol.
|
|
|
getDays()
Return number of days.
|
|
|
Return the days part of this duration.
|
|
|
getHours()
Return number of hours.
|
|
|
Return the hours part of this duration.
|
|
|
Return number of milliseconds.
|
|
|
Return the milliseconds part of this duration.
|
|
|
Return number of minutes.
|
|
|
Return the minutes part of this duration.
|
|
|
Return number of seconds.
|
|
|
Return the seconds part of this duration.
|
|
| <static> |
baja.RelTime.make(obj)
Make a RelTime.
|
|
make(obj)
Make a RelTime.
|
|
|
toString()
Return a String representation of a RelTime.
|
|
|
valueOf()
Return number of milliseconds.
|
Field Detail
<static>
baja.RelTime.DAY
RelTime instance for a day.
<static>
baja.RelTime.DEFAULT
Default RelTime instance.
<static>
baja.RelTime.HOUR
RelTime instance for an hour.
<static>
baja.RelTime.MILLIS_IN_DAY
Milliseconds in a day (Number).
<static>
baja.RelTime.MILLIS_IN_HOUR
Milliseconds in an hour (Number).
<static>
baja.RelTime.MILLIS_IN_MINUTE
Milliseconds in a minute (Number).
<static>
baja.RelTime.MILLIS_IN_SECOND
Milliseconds in a second (Number).
<static>
baja.RelTime.MINUTE
RelTime instance for a minute.
<static>
baja.RelTime.SECOND
RelTime instance for a second.
Method Detail
{baja.RelTime}
decodeFromString(str)
Decode a RelTime from a String.
- Parameters:
- {String} str
- Returns:
- {baja.RelTime}
{String}
encodeToString()
Encode the RelTime to a String.
- Returns:
- {String}
{Boolean}
equals(obj)
Equality test.
- Parameters:
- obj
- Returns:
- {Boolean}
{String}
getDataTypeSymbol()
Return the data type symbol.
- Returns:
- {String}
{Number}
getDays()
Return number of days.
- Returns:
- {Number}
{Number}
getDaysPart()
Return the days part of this duration.
- Returns:
- {Number}
{Number}
getHours()
Return number of hours.
- Returns:
- {Number}
{Number}
getHoursPart()
Return the hours part of this duration.
- Returns:
- {Number}
{Number}
getMillis()
Return number of milliseconds.
- Returns:
- {Number}
{Number}
getMillisPart()
Return the milliseconds part of this duration.
- Returns:
- {Number}
{Number}
getMinutes()
Return number of minutes.
- Returns:
- {Number}
{Number}
getMinutesPart()
Return the minutes part of this duration.
- Returns:
- {Number}
{Number}
getSeconds()
Return number of seconds.
- Returns:
- {Number}
{Number}
getSecondsPart()
Return the seconds part of this duration.
- Returns:
- {Number}
<static>
{baja.RelTime}
baja.RelTime.make(obj)
Make a RelTime.
This method can take a number of milliseconds of an Object Literal with the method's argument...
var rt1 = baja.RelTime.make(1000); // One second
// ...or we can specify an Object Literal for more arguments...
// Create a RelTime with 2 days + 2 hours + 2 minutes + 2 seconds + 2 milliseconds...
var rt2 = baja.RelTime.make({
days: 2,
hours: 2,
minutes: 2,
seconds: 2,
ms: 2
});
- Parameters:
- {Object|Number} obj Optional
- the Object Literal or the number of milliseconds.
- {Object} obj.days Optional
- the number of days.
- {Object} obj.hours Optional
- the number of hours.
- {Object} obj.minutes Optional
- the number of minutes.
- {Object} obj.seconds Optional
- the number of seconds.
- {Object} obj.ms Optional
- the number of milliseconds.
- Returns:
- {baja.RelTime}
{baja.RelTime}
make(obj)
Make a RelTime.
This method can take a number of milliseconds of an Object Literal with the method's argument...
var rt1 = baja.$("baja:RelTime").make(1000); // One second
// ...or we can specify an Object Literal for more arguments...
// Create a RelTime with 2 days + 2 hours + 2 minutes + 2 seconds + 2 milliseconds...
var rt2 = baja.$("baja:RelTime").make({
days: 2,
hours: 2,
minutes: 2,
seconds: 2,
ms: 2
});
- Parameters:
- {Object|Number} obj Optional
- the Object Literal or the number of milliseconds.
- {Object} obj.days Optional
- the number of days.
- {Object} obj.hours Optional
- the number of hours.
- {Object} obj.minutes Optional
- the number of minutes.
- {Object} obj.seconds Optional
- the number of seconds.
- {Object} obj.ms Optional
- the number of milliseconds.
- Returns:
- {baja.RelTime}
{String}
toString()
Return a String representation of a RelTime.
- Returns:
- {String}
{Number}
valueOf()
Return number of milliseconds.
- Returns:
- {Number}