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
Implements
Constructors
constructor
⊕ new Moment(value?: Moment | Date | AnyNumber): Moment
Defined in 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:897
Accessors
encodedLength
getencodedLength(): number
Defined in Moment.ts:51
description: The length of the value when encoded as a Uint8Array
Returns: number
Methods
bitLength
▸ bitLength(): UIntBitLength
Defined in Moment.ts:58
description: Returns the number of bits in the value
Returns: UIntBitLength
toBn
▸ toBn(): BN
Defined in Moment.ts:65
description: Returns the BN representation of the timestamp
Returns: BN
toHex
▸ toHex(): string
Defined in Moment.ts:72
description: Returns a hex string representation of the value
Returns: string
toJSON
▸ toJSON(): any
Implementation of Codec.toJSON
Overrides Date.toJSON
Defined in Moment.ts:79
description: Converts the Object to JSON, typically used for RPC transfers
Returns: any
toNumber
▸ toNumber(): number
Defined in Moment.ts:86
description: Returns the number representation for the timestamp
Returns: number
toString
▸ toString(): string
Implementation of Codec.toString
Overrides Date.toString
Defined in Moment.ts:93
description: Returns the string representation of the value
Returns: string
toU8a
▸ toU8a(isBare?: undefined | false | true): Uint8Array
Defined in Moment.ts:102
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 Moment.ts:34
Parameters:
| Name | Type |
|---|---|
| value | Moment | Date | AnyNumber |
Returns: Date