From ffcaa21348f877b8b12ebad7af170b5e54ae74a9 Mon Sep 17 00:00:00 2001 From: WaeCo Date: Mon, 24 Jun 2019 14:33:25 +0200 Subject: [PATCH] fix format for duration 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 --- src/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.jsx b/src/index.jsx index d09ec36..206cd0c 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -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);