Commit b237bf3b authored by Joaquim Rocha's avatar Joaquim Rocha
Browse files

frontend: Add a date format property to the DateLabel

parent dcffcc0f
xterm-windows-mode action-button-improvements add-cluster-to-notification-area add-fullscreen-to-editor add-labs add-msi-installer add-notification-page add_manual_trigger_docker_action apply-multiple-resources autoscalers_resource_quota backend-dependencies bump-chocolatey-0.13.0 choco-bump-0.12.1 cluster_chooser config_from_env de-de dep-updates2 dependabot/npm_and_yarn/frontend/d3-color-and-recharts-3.1.0 dependabot/npm_and_yarn/frontend/deep-object-diff-1.1.9 dependabot/npm_and_yarn/frontend/loader-utils-1.4.2 dependabot/npm_and_yarn/plugins/examples/change-logo/glob-parent-and-kinvolk/headlamp-plugin-5.1.2 dependabot/npm_and_yarn/plugins/examples/cluster-chooser/glob-parent-and-kinvolk/headlamp-plugin-5.1.2 dependabot/npm_and_yarn/plugins/examples/dynamic-clusters/glob-parent-and-kinvolk/headlamp-plugin-5.1.2 docker_desktop_ext dont-wrap-header-cells e2e-container e2e-login e2e-playwright endpoints errcb-fix example-fixes fetch-pods-by-labels fix-cluster-chooser fix-crash-in-label-selector fix-filter-when-items-are-numbers fix-navigating-during-delete-op fix-release-note-stuck-issue fix-simple-table fix-table-filter fix_manual_trigger_gh_action fr-fr gh_action_automate_pr go-back-through-location-stack headlamp-plugin-0.5.2-b headlamp-upgrade-audit hide-appbar improve-app-menus improve-pod-status localefix mui-v5-upgrade new-k8s-secret no-cluster-no-auth-required optimize-use-get persist-url-params plugin-source plugin-tests-in-js port-forwarding push-asset rc-0.12.0 rc-0.12.1 rc-0.13.0 render-logs-using-xterm resource-class-issue resources-json role_bind_info search-involved-object-type-events-table set-default-namespace shorter-resource-age show-dialog-if-release-fetch-failed sidebarroutefilter simple-table-details-from-url simplify-testing test-cleanup update-examples-052 update-signing-email upgrade-new-things v0.13.0 v0.12.1 v0.12.0 headlamp-plugin-0.5.3 headlamp-plugin-0.5.2 headlamp-helm-0.8.0
No related merge requests found
Showing with 10 additions and 3 deletions
+10 -3
......@@ -4,7 +4,7 @@ import Grid from '@material-ui/core/Grid';
import { makeStyles, useTheme } from '@material-ui/core/styles';
import Typography from '@material-ui/core/Typography';
import React from 'react';
import { localeDate, timeAgo } from '../../lib/util';
import { DateFormatOptions, localeDate, timeAgo } from '../../lib/util';
import { LightTooltip, TooltipIcon } from './Tooltip';
const useStyles = makeStyles(theme => ({
......@@ -176,9 +176,16 @@ export function HoverInfoLabel(props: HoverInfoLabelProps) {
export interface DateLabelProps {
date: number | string | Date;
format?: DateFormatOptions;
}
export function DateLabel(props: DateLabelProps) {
const { date } = props;
return <HoverInfoLabel label={timeAgo(date)} hoverInfo={localeDate(date)} icon="mdi:calendar" />;
const { date, format = 'brief' } = props;
return (
<HoverInfoLabel
label={timeAgo(date, { format })}
hoverInfo={localeDate(date)}
icon="mdi:calendar"
/>
);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment