LocalTime

LocalTime

new LocalTime()

Methods

dayOfYear() → {number}

Returns:
Type
number

fromGmtTimeWithTimeZone(gmt, tz)

init a LocalTime instance by GmtTime and TimeZone.

Parameters:
Name Type Description
gmt

GmtTime, stands for the seconds since EPOCH.

tz

time zone of LocalTime.

fromUtcString(str)

convert an utc time string to LocalTime. A valid utc time string must be formatted as '1989-06-04T10:30:00Z+08:00', "Z+08:00" is time zone setting, it is "Asia/Shanghai", also "Z+00:00" is time zone of Greenwich.

Parameters:
Name Type Description
str

a readable UTC date-time string, such as '1989-06-04T10:30:00Z+08:00'

isValid()

to check if a setted LocalTime is valid or not.

Returns:

boolean

parseUtcString(utcstr) → {Array.<any>}

Parameters:
Name Type Description
utcstr
Returns:
Type
Array.<any>

toString()

format a LocalTime instance as "yyyy-mm-ddThh:mm:ssZ+hh:mm" according to its time zone.

Returns:

a string.

LocalTime

new LocalTime()

class LocalTime stands for a calender time according to a specific TimeZone.

Example
import { LocalTime } from "ultrain-ts-lib/src/time;"

Methods

dayOfYear() → {number}

Returns:
Type
number

fromGmtTimeWithTimeZone(gmt, tz)

init a LocalTime instance by GmtTime and TimeZone.

Parameters:
Name Type Description
gmt

GmtTime, stands for the seconds since EPOCH.

tz

time zone of LocalTime.

fromUtcString(str)

convert an utc time string to LocalTime. A valid utc time string must be formatted as '1989-06-04T10:30:00Z+08:00', "Z+08:00" is time zone setting, it is "Asia/Shanghai", also "Z+00:00" is time zone of Greenwich.

Parameters:
Name Type Description
str

a readable UTC date-time string, such as '1989-06-04T10:30:00Z+08:00'

isValid()

to check if a setted LocalTime is valid or not.

Returns:

boolean

parseUtcString(utcstr) → {Array.<any>}

Parameters:
Name Type Description
utcstr
Returns:
Type
Array.<any>

toString()

format a LocalTime instance as "yyyy-mm-ddThh:mm:ssZ+hh:mm" according to its time zone.

Returns:

a string.