Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | 1x 75x 75x 1x 35x 35x 35x 35x 35x 35x 35x 35x 35x 1x 74x 74x 74x 74x 74x 1x 1x 1x 1x 1x 153x 2x 2x 151x 153x 1x 1x 150x 150x 150x 150x 150x 150x 150x 150x 150x 1x 84x 1x 1x 83x 83x 83x 84x 1x 1x 84x 1x 1x 1x 84x 2x 2x 2x 84x 2x 2x 2x 77x 77x | const padWithZero = (n) => {
return n < 10 ? "0" + n : n;
};
const timestampToDate = (timestamp) => {
var date = new Date(timestamp);
return (
date.getFullYear() +
"-" +
padWithZero(date.getMonth() + 1) +
"-" +
padWithZero(date.getDate())
);
};
const daysSinceTimestamp = (date) => {
var today = new Date();
var startingDate = new Date(date);
var timeDiff = Math.abs(today.getTime() - startingDate.getTime());
return Math.ceil(timeDiff / (1000 * 3600 * 24));
};
const minutesInSeconds = 60;
const hourInSeconds = 60 * minutesInSeconds;
const dayInSeconds = 24 * hourInSeconds;
const weekInSeconds = 7 * dayInSeconds;
export function formatDateTime(dateTimeString) {
if (!dateTimeString) {
return "";
}
const date = new Date(dateTimeString);
if (Number.isNaN(date.getTime())) {
return "";
}
return new Intl.DateTimeFormat("en-US", {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "numeric",
minute: "2-digit",
hour12: true,
}).format(date);
}
export function formatTime(timeString) {
if (!timeString) {
return "";
}
const now = new Date();
const dateFromEpoch = new Date(timeString);
const secondsPast = Math.floor((now - dateFromEpoch) / 1000);
if (secondsPast < minutesInSeconds * 2) {
return "Online now";
}
if (secondsPast < hourInSeconds) {
const minutes = Math.floor(secondsPast / 60);
return `${minutes} minutes ago`;
}
if (secondsPast < dayInSeconds) {
const hours = Math.floor(secondsPast / 3600);
return `${hours} hour${hours > 1 ? "s" : ""} ago`;
}
if (secondsPast < weekInSeconds) {
const days = Math.floor(secondsPast / 86400);
return `${days} day${days > 1 ? "s" : ""} ago`;
}
return dateFromEpoch.toLocaleDateString();
}
export { timestampToDate, padWithZero, daysSinceTimestamp };
|