differentiate time on proposals list
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
670e85889b
commit
43620736cf
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ghost-dao-interface",
|
"name": "ghost-dao-interface",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.5.34",
|
"version": "0.5.35",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@ -349,10 +349,11 @@ const ProposalFilterTrigger = ({ trigger, setTrigger }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const convertDeadline = (deadline, blockNumber, chainId) => {
|
const convertDeadline = (deadline, blockNumber, chainId) => {
|
||||||
const diff = blockNumber > deadline ? blockNumber - deadline : deadline - blockNumber;
|
const alreadyHappened = blockNumber > deadline;
|
||||||
|
const diff = alreadyHappened ? blockNumber - deadline : deadline - blockNumber;
|
||||||
const voteSeconds = Number(diff * networkAvgBlockSpeed(chainId));
|
const voteSeconds = Number(diff * networkAvgBlockSpeed(chainId));
|
||||||
|
|
||||||
const result = prettifySeconds(voteSeconds, "mins");
|
const result = prettifySeconds(voteSeconds, "min");
|
||||||
if (result === "now") {
|
if (result === "now") {
|
||||||
return new Date(Date.now()).toLocaleDateString('en-US', {
|
return new Date(Date.now()).toLocaleDateString('en-US', {
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
@ -361,7 +362,10 @@ const convertDeadline = (deadline, blockNumber, chainId) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return `in ${result}`;
|
const prefix = alreadyHappened ? "" : "in ";
|
||||||
|
const postfix = alreadyHappened ? " ago" : "";
|
||||||
|
|
||||||
|
return `${prefix}${result}${postfix}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ProposalsList;
|
export default ProposalsList;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user