name: Moment
description: A wrapper around seconds/timestamps. Internally the representation only has second precicion (aligning with Rust), so any numbers passed an/out are always per-second. For any encoding/decoding the 1000 multiplier would be applied to get it in line with JavaScript formats. It extends the base JS Date object and has all the methods available that are applicable to any Date
Hierarchy
Date
↳ Moment
↳ MomentOf
Implements
Constructors
constructor
⊕ new Moment(value?: Moment | Date | AnyNumber): Moment
Defined in primitive/Moment.ts:24
Parameters:
| Name | Type | Default value |
|---|---|---|
Default value value | Moment | Date | AnyNumber | 0 |
Returns: Moment
Properties
<Static> Date
● Date: DateConstructor
Defined in /home/travis/build/polkadot-js/api/node_modules/typescript/lib/lib.es5.d.ts:907
Accessors
encodedLength
get encodedLength(): number
Defined in primitive/Moment.ts:51
description: The length of the value when encoded as a Uint8Array
Returns: number
isEmpty
get isEmpty(): boolean
Defined in primitive/Moment.ts:58
description: Checks if the value is an empty value
Returns: boolean
Methods
bitLength
▸ bitLength(): UIntBitLength
Defined in primitive/Moment.ts:72
description: Returns the number of bits in the value
Returns: UIntBitLength
eq
▸ eq(other?: any): boolean
Defined in primitive/Moment.ts:65
description: Compares the value of the input to see if there is a match
Parameters:
| Name | Type |
|---|---|
Optional other | any |
Returns: boolean
toBn
▸ toBn(): BN
Defined in primitive/Moment.ts:79
description: Returns the BN representation of the timestamp
Returns: BN
toHex
▸ toHex(): string
Defined in primitive/Moment.ts:86
description: Returns a hex string representation of the value
Returns: string
toJSON
▸ toJSON(): any
Implementation of Codec.toJSON
Overrides Date.toJSON
Defined in primitive/Moment.ts:93
description: Converts the Object to JSON, typically used for RPC transfers
Returns: any
toNumber
▸ toNumber(): number
Defined in primitive/Moment.ts:100
description: Returns the number representation for the timestamp
Returns: number
toString
▸ toString(): string
Implementation of Codec.toString
Overrides Date.toString
Defined in primitive/Moment.ts:107
description: Returns the string representation of the value
Returns: string
toU8a
▸ toU8a(isBare?: undefined | false | true): Uint8Array
Defined in primitive/Moment.ts:116
description: Encodes the value as a Uint8Array as per the parity-codec specifications
Parameters:
| Name | Type | Description |
|---|---|---|
Optional isBare | undefined | false | true | true when the value has none of the type-specific prefixes (internal) |
Returns: Uint8Array
<Static> decodeMoment
▸ decodeMoment(value: Moment | Date | AnyNumber): Date
Defined in primitive/Moment.ts:34
Parameters:
| Name | Type |
|---|---|
| value | Moment | Date | AnyNumber |
Returns: Date