Skip to content

Commit

Permalink
fix format for duration
Browse files Browse the repository at this point in the history
This correctly applies format after the duration was calculated.
Previously format would always be applied first and the duration parsing would not work since it expects a number.

Fixes: #92
  • Loading branch information
Niels-Be committed Jun 24, 2019
1 parent 6f7ec60 commit ffcaa21
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export default class Moment extends React.Component {

const fromNowPeriod = Boolean(fromNowDuring) && -datetime.diff(moment()) < fromNowDuring;
let content = '';
if (format && !fromNowPeriod) {
if (format && !fromNowPeriod && !(durationFromNow || duration)) {
content = datetime.format(format);
} else if (from) {
content = datetime.from(from, ago);
Expand Down

0 comments on commit ffcaa21

Please sign in to comment.