Class baja.Time
Extends
baja.Simple.
Represents a baja:Time in BajaScript.
Time stores a time of day which is independent of any date in the past or future.
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.Time.DEFAULT
Default Time instance.
|
| <static> |
baja.Time.MIDNIGHT
Midnight Time.
|
- Fields borrowed from class baja.Value:
- newCopy
- Fields borrowed from class baja.Object:
- equivalent, getIcon
| Method Attributes | Method Name and Description |
|---|---|
|
add(duration)
Return a new time of day by adding the specified
duration.
|
|
|
decodeFromString(str)
Decode a Time from a String.
|
|
|
Encode a Time to a String.
|
|
|
equals(obj)
Equality test.
|
|
|
getHour()
Return hours (0-23).
|
|
|
Return milliseconds (0-999).
|
|
|
Return minutes (0-59).
|
|
|
Return seconds (0-59).
|
|
|
Return the milliseconds since the start of the day.
|
|
|
isAfter(time)
Return true if the specified time is after this time.
|
|
|
isBefore(time)
Return true if the specified time is before this time.
|
|
| <static> |
baja.Time.make(obj)
Make a Time.
|
|
make(obj)
Make a Time.
|
|
|
toString(obj)
Return a String representation of the time.
|
Field Detail
<static>
baja.Time.DEFAULT
Default Time instance.
<static>
baja.Time.MIDNIGHT
Midnight Time.
Method Detail
{baja.Time}
add(duration)
Return a new time of day by adding the specified
duration. If the result goes past midnight, then roll
into the next day.
- Parameters:
- {baja.RelTime|baja.Time|Number} duration
- - RelTime or number of millis
- Returns:
- {baja.Time} the new time with the duration added on.
{baja.Time}
decodeFromString(str)
Decode a Time from a String.
- Parameters:
- {String} str
- Returns:
- {baja.Time}
{String}
encodeToString()
Encode a Time to a String.
- Returns:
- {String}
{Boolean}
equals(obj)
Equality test.
- Parameters:
- obj
- Returns:
- {Boolean}
{Number}
getHour()
Return hours (0-23).
- Returns:
- {Number}
{Number}
getMillisecond()
Return milliseconds (0-999).
- Returns:
- {Number}
{Number}
getMinute()
Return minutes (0-59).
- Returns:
- {Number}
{Number}
getSecond()
Return seconds (0-59).
- Returns:
- {Number}
{Number}
getTimeOfDayMillis()
Return the milliseconds since the start of the day.
- Returns:
- {Number}
{Boolean}
isAfter(time)
Return true if the specified time is after this time.
- Parameters:
- {baja.Time} time
- Returns:
- {Boolean}
{Boolean}
isBefore(time)
Return true if the specified time is before this time.
- Parameters:
- {baja.Time} time
- Returns:
- {Boolean}
<static>
{baja.Time}
baja.Time.make(obj)
Make a Time.
An Object Liternal is used for the method's arguments...
var t1 = baja.Time.make({
hour: 23,
min: 12,
sec: 15,
ms: 789
});
// ...or use a baja.RelTime to specify hour, min, sec and ms...
var t2 = baja.Time.make({
relTime: myRelTime
});
// ...or pass in milliseconds past midnight...
var t3 = baja.Time.make(12345);
- Parameters:
- {Object} obj
- the Object Liternal used for the method's arguments.
- {Number} obj.hour Optional
- hours (0-23).
- {Number} obj.min Optional
- minutes (0-59).
- {Number} obj.sec Optional
- seconds (0-59).
- {Number} obj.ms Optional
- milliseconds (0-999).
- {baja.RelTime} obj.relTime Optional
- if defined, this is the milliseconds since the start of the day. This overrides the other hour, min, sec and ms arguments.
- Returns:
- {baja.Time} the time.
{baja.Time}
make(obj)
Make a Time.
An Object Liternal is used for the method's arguments...
var t1 = baja.$("baja:Time").make({
hour: 23,
min: 12,
sec: 15,
ms: 789
});
// ...or use a baja.RelTime to specify hour, min, sec and ms...
var t2 = baja.$("baja:Time").make({
relTime: timeOfDayMillis
});
// ...or pass in milliseconds past midnight...
var t3 = baja.Time.make(12345);
- Parameters:
- {Object} obj
- the Object Liternal used for the method's arguments.
- {Number} obj.hour Optional
- hours (0-23).
- {Number} obj.min Optional
- minutes (0-59).
- {Number} obj.sec Optional
- seconds (0-59).
- {Number} obj.ms Optional
- milliseconds (0-999).
- {baja.RelTime} obj.relTime Optional
- if defined, this is the milliseconds since the start of the day. This overrides the other hour, min, sec and ms arguments.
- Returns:
- {baja.Time} the time.
{String}
toString(obj)
Return a String representation of the time.
- Parameters:
- {Object} obj Optional
- the Object Literal for the method's arguments.
- {Number} obj.show Optional
- flags used to format the time. For more information, please see baja.TimeFormat.
- Returns:
- {String}