Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Headlamp
Commits
b237bf3b
Commit
b237bf3b
authored
2 years ago
by
Joaquim Rocha
Browse files
Options
Download
Email Patches
Plain Diff
frontend: Add a date format property to the DateLabel
parent
dcffcc0f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/components/common/Label.tsx
+10
-3
frontend/src/components/common/Label.tsx
with
10 additions
and
3 deletions
+10
-3
frontend/src/components/common/Label.tsx
+
10
-
3
View file @
b237bf3b
...
...
@@ -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"
/>
);
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help