Skip to content

Commit

Permalink
Moved moment config to app/config
Browse files Browse the repository at this point in the history
  • Loading branch information
ranbena committed Jul 27, 2019
1 parent 29d15f0 commit 56b6571
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
18 changes: 0 additions & 18 deletions client/app/components/TimeAgo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,6 @@ import { clientConfig } from '@/services/auth';
import useForceUpdate from '@/lib/hooks/useForceUpdate';
import Tooltip from 'antd/lib/tooltip';

moment.updateLocale('en', {
relativeTime: {
future: '%s',
past: '%s',
s: 'just now',
m: 'a minute ago',
mm: '%d minutes ago',
h: 'an hour ago',
hh: '%d hours ago',
d: 'a day ago',
dd: '%d days ago',
M: 'a month ago',
MM: '%d months ago',
y: 'a year ago',
yy: '%d years ago',
},
});

function toMoment(value) {
value = !isNil(value) ? moment(value) : null;
return value && value.isValid() ? value : null;
Expand Down
19 changes: 19 additions & 0 deletions client/app/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import registerDirectives from '@/directives';
import markdownFilter from '@/filters/markdown';
import dateTimeFilter from '@/filters/datetime';
import './antd-spinner';
import moment from 'moment';

const logger = debug('redash:config');

Expand All @@ -41,6 +42,24 @@ Pace.options.shouldHandlePushState = (prevUrl, newUrl) => {
return prevPrefix !== newPrefix;
};

moment.updateLocale('en', {
relativeTime: {
future: '%s',
past: '%s',
s: 'just now',
m: 'a minute ago',
mm: '%d minutes ago',
h: 'an hour ago',
hh: '%d hours ago',
d: 'a day ago',
dd: '%d days ago',
M: 'a month ago',
MM: '%d months ago',
y: 'a year ago',
yy: '%d years ago',
},
});

const requirements = [
ngRoute,
ngResource,
Expand Down

0 comments on commit 56b6571

Please sign in to comment.