Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add format for compact absolute timestamp #376

Merged
merged 1 commit into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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