Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DayType

A type storing a specific day in time. The value is stored as a 3-byte signed integer.

Example:

let type = new sb.DayType

Hierarchy

  • ChronoType
    • DayType

Index

Constructors

constructor

  • Returns DayType

Accessors

Static _value

  • get _value(): number

Methods

addToBuffer

consumeValue

  • consumeValue(buffer: ArrayBuffer, offset: number): ReadResult<Date>
  • Parameters

    • buffer: ArrayBuffer
    • offset: number

    Returns ReadResult<Date>

equals

  • equals(otherType: unknown): boolean
  • Parameters

    • otherType: unknown

    Returns boolean

getHash

  • getHash(): string

getSignature

  • getSignature(): string

Private isBuffer

Private isSameType

  • isSameType(otherType: unknown): otherType is DayType
  • Determines whether the input is a Type with the same class

    Parameters

    • otherType: unknown

      A value, usually a Type instance

    Returns otherType is DayType

    whether this and otherType are instances of the same Type class

readValue

  • readValue(valueBuffer: ArrayBuffer | Uint8Array, offset?: number): Date
  • Parameters

    • valueBuffer: ArrayBuffer | Uint8Array
    • offset: number = 0

    Returns Date

toBuffer

  • toBuffer(): ArrayBuffer

valueBuffer

  • valueBuffer(value: Date): ArrayBuffer
  • Parameters

    • value: Date

    Returns ArrayBuffer

writeValue

  • Appends value bytes to an AppendableBuffer according to the type. Writes Date objects but ignores all units smaller than the day.

    Example:

    type.writeValue(buffer, new Date(2001, 0, 1)) //Jan 1st, 2001
    
    throws

    If the value doesn't match the type, e.g. new sb.StringType().writeValue(buffer, 23)

    Parameters

    • buffer: AppendableBuffer

      The buffer to which to append

    • value: Date

      The value to write

    Returns void

Generated using TypeDoc