mirror of
https://github.com/skooner-k8s/skooner.git
synced 2026-02-14 17:49:55 +00:00
NOBUG: fix linter error
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import Field from './field';
|
||||
import {objectMap} from './listViewHelpers';
|
||||
import {safeParseTimeToDate} from '../utils/dates'
|
||||
import {safeParseTimeToDate} from '../utils/dates';
|
||||
|
||||
const MetadataFields = ({item}: {[key: string]: any}) => (
|
||||
<>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import HumanizeDuration from "humanize-duration";
|
||||
import { k8s } from "../proto/proto";
|
||||
import HumanizeDuration from 'humanize-duration';
|
||||
import {k8s} from '../proto/proto';
|
||||
|
||||
/**
|
||||
* A simple humanizer to merely differentiate between months and minutes.
|
||||
@@ -27,22 +27,22 @@ const shortEnglishHumanizer = HumanizeDuration.humanizer({
|
||||
*
|
||||
*/
|
||||
export default function fromNow(
|
||||
epochtimestampMs: number | string | k8s.io.apimachinery.pkg.apis.meta.v1.ITime
|
||||
epochtimestampMs: number | string | k8s.io.apimachinery.pkg.apis.meta.v1.ITime,
|
||||
) {
|
||||
const diff = Date.now() - safeParseTimeToDate(epochtimestampMs).getTime();
|
||||
return formatDuration(diff);
|
||||
const diff = Date.now() - safeParseTimeToDate(epochtimestampMs).getTime();
|
||||
return formatDuration(diff);
|
||||
}
|
||||
|
||||
export function safeParseTimeToDate(
|
||||
epochtimestampMs: number | string | k8s.io.apimachinery.pkg.apis.meta.v1.ITime
|
||||
epochtimestampMs: number | string | k8s.io.apimachinery.pkg.apis.meta.v1.ITime,
|
||||
) {
|
||||
if (
|
||||
typeof epochtimestampMs !== "number" &&
|
||||
typeof epochtimestampMs !== "string"
|
||||
) {
|
||||
epochtimestampMs = Number(epochtimestampMs.seconds) * 1000;
|
||||
}
|
||||
return new Date(epochtimestampMs);
|
||||
if (
|
||||
typeof epochtimestampMs !== 'number'
|
||||
&& typeof epochtimestampMs !== 'string'
|
||||
) {
|
||||
return new Date(Number(epochtimestampMs.seconds) * 1000);
|
||||
}
|
||||
return new Date(epochtimestampMs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user