Hiyve Components - v1.0.0
    Preparing search index...
    • Get time remaining for a poll with duration.

      Parameters

      • poll: Poll

        The poll to check

      • serverTimeOffset: number = 0

        Optional offset in ms to adjust for server time (default: 0)

      Returns number | null

      Time remaining in seconds, or null if no duration set

      Supports an optional server time offset to synchronize timers across clients with different system clocks. The offset is calculated as: serverTime - clientTime. A positive offset means the server is ahead of the client.

      // Without offset (uses client time)
      const remaining = getTimeRemaining(poll);

      // With server time synchronization
      const serverOffset = serverTime - Date.now();
      const remaining = getTimeRemaining(poll, serverOffset);