decent-bet/solido

Web native Solido - Remove moment used in Utils

Closed this issue · 2 comments

Web native Solido - Remove moment used in Utils
import moment from 'moment';
export class BlockNumberDateMapper {
    constructor() { }
    static getPastBlockNumber(currentBlock, date) {
        const BLOCK_PERIOD = 10;
        const now = moment();
        const query = moment(date);
        const seconds = now.diff(query, 'seconds');
        const blocks = Math.round(seconds / BLOCK_PERIOD);
        const findBlock = currentBlock - blocks;
        return findBlock;
    }
}

Done