@edgeandnode/common
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -1,2 +0,2 @@ | ||
export { generateExampleQuery, connectProvider, getContract, getTxLink, formatUnitsOriginal, formatWithNumeral, buildEnsDataLoader, ensLookup, ensLookups, unixDateFromNow, dateFromNow, dateStringFromNow, dateUntilNow, formatDuration, formatHourMin, getDate, blocksToDays, delegatorCooldownToDays, formatDayHourMin } from './utils'; | ||
export { generateExampleQuery, connectProvider, getContract, getTxLink, formatUnitsOriginal, formatWithNumeral, buildEnsDataLoader, ensLookup, ensLookups, unixDateFromNow, dateFromNow, dateStringFromNow, dateUntilNow, formatDuration, formatHourMin, getDate, blocksToDays, delegatorCooldownToDays, formatDayHourMin, formatDays } from './utils'; | ||
export { SECONDS_IN_DAY, ETHEREUM_BLOCK_TIME } from './constants'; |
@@ -269,4 +269,13 @@ import gql from 'graphql-tag'; | ||
}; | ||
/** | ||
* Convert seconds to days | ||
* @param seconds Number of seconds | ||
* @returns Number of days, e.g. "3 days" | ||
*/ | ||
const formatDays = (seconds) => { | ||
const numDays = Math.round(seconds / SECONDS_IN_DAY); | ||
return `${numDays} ${numDays === 1 ? 'day' : 'days'}`; | ||
}; | ||
export { ETHEREUM_BLOCK_TIME, SECONDS_IN_DAY, blocksToDays, buildEnsDataLoader, connectProvider, dateFromNow, dateStringFromNow, dateUntilNow, delegatorCooldownToDays, ensLookup, ensLookups, formatDayHourMin, formatDuration, formatHourMin, formatUnitsOriginal, formatWithNumeral, generateExampleQuery, getContract, getDate, getTxLink, unixDateFromNow }; | ||
export { ETHEREUM_BLOCK_TIME, SECONDS_IN_DAY, blocksToDays, buildEnsDataLoader, connectProvider, dateFromNow, dateStringFromNow, dateUntilNow, delegatorCooldownToDays, ensLookup, ensLookups, formatDayHourMin, formatDays, formatDuration, formatHourMin, formatUnitsOriginal, formatWithNumeral, generateExampleQuery, getContract, getDate, getTxLink, unixDateFromNow }; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -282,2 +282,11 @@ 'use strict'; | ||
}; | ||
/** | ||
* Convert seconds to days | ||
* @param seconds Number of seconds | ||
* @returns Number of days, e.g. "3 days" | ||
*/ | ||
const formatDays = (seconds) => { | ||
const numDays = Math.round(seconds / SECONDS_IN_DAY); | ||
return `${numDays} ${numDays === 1 ? 'day' : 'days'}`; | ||
}; | ||
@@ -296,2 +305,3 @@ exports.ETHEREUM_BLOCK_TIME = ETHEREUM_BLOCK_TIME; | ||
exports.formatDayHourMin = formatDayHourMin; | ||
exports.formatDays = formatDays; | ||
exports.formatDuration = formatDuration; | ||
@@ -298,0 +308,0 @@ exports.formatHourMin = formatHourMin; |
{ | ||
"name": "@edgeandnode/common", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Common Edge & Node utils and types", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
69162
677