Skip to content

Blue Railroad datepicker: improve UI and block height accuracy #36

@magent-cryptograss

Description

@magent-cryptograss

Current State

The date-to-blockheight converter is working but has room for improvement:

  1. No popup datepicker - Currently using native <input type="datetime-local"> which varies by browser. A proper datepicker widget would provide a more consistent UX.

  2. Block height accuracy - Current calculation uses a fixed 12.12 second average block time:

    var blocksDiff = Math.round((refTimestamp - targetTimestamp) / 12.12);
    return refBlock - blocksDiff;

    This could be improved by:

    • Fetching actual block timestamps from an API for more precise calculation
    • Using a reference block closer to the target date
    • Accounting for block time variations over different periods

Location

extensions/BlueRailroadIntegration/resources/ext.bluerailroad.datepicker.js

Possible Improvements

  • Use a JS datepicker library (flatpickr, pikaday, etc.) for consistent cross-browser UI
  • Query Etherscan/Alchemy API for actual block-to-timestamp mapping
  • Add visual feedback showing confidence level of the estimate
  • Consider using binary search between known block timestamps for better accuracy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions