Skip to content

Commit

Permalink
Merge pull request #376 from weaveworks/timestamp-compact-absolute
Browse files Browse the repository at this point in the history
add format for compact absolute timestamp
  • Loading branch information
guyfedwards authored Sep 12, 2018
2 parents 3310616 + 4cb5d0f commit 6e59894
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/TimestampTag/TimestampTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ class TimestampTag extends React.Component {
>
{relative
? momentTimestamp.locale(relativeLocale).fromNow(compact)
: momentTimestamp.startOf('second').format()}
: momentTimestamp
.startOf('second')
.format(compact ? 'YYYY-MM-DD' : '')}
</Timestamp>
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/components/TimestampTag/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export default class TimestampTagExample extends React.Component {
/>
<Info>Absolute timestamp</Info>
<TimestampTag timestamp={inputTimestamp} />
<Info>Absolute timestamp (compact)</Info>
<TimestampTag compact timestamp={inputTimestamp} />
<Info>Relative timestamp (default)</Info>
<TimestampTag relative timestamp={inputTimestamp} />
<Info>Relative timestamp (compact)</Info>
Expand Down

0 comments on commit 6e59894

Please sign in to comment.