Skip to content

Commit

Permalink
Fix date-fns changes:
Browse files Browse the repository at this point in the history
  • Loading branch information
rkuykendall committed Feb 14, 2020
1 parent 0ed5043 commit 5e736ac
Show file tree
Hide file tree
Showing 5 changed files with 1,012 additions and 1,803 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js
node_js:
- "10"
- "8"
- "node"
- "lts/*"
cache:
directories:
- "node_modules"
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,53 +72,53 @@
"babel-core": "7.0.0-bridge.0"
},
"devDependencies": {
"@babel/core": "^7.3.4",
"@babel/core": "^7.8.4",
"@babel/plugin-proposal-class-properties": "^7.3.4",
"@babel/plugin-proposal-decorators": "^7.3.0",
"@babel/plugin-proposal-export-default-from": "^7.2.0",
"@babel/plugin-proposal-optional-chaining": "^7.2.0",
"@babel/polyfill": "^7.2.5",
"@babel/preset-env": "^7.3.4",
"@babel/preset-env": "^7.8.4",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.3.3",
"@mighty-justice/tslint-config": "^0.3.0",
"@mighty-justice/tslint-config": "^1.0.2",
"@types/classnames": "^2.2.7",
"@types/enzyme": "^3.9.0",
"@types/enzyme-adapter-react-16": "^1.0.5",
"@types/jest": "^25.1.0",
"@types/enzyme": "^3.10.5",
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/jest": "^25.1.2",
"@types/lodash": "^4.14.122",
"@types/numeral": "^0.0.26",
"@types/react": "16.9.19",
"babelrc-rollup": "^3.0.0",
"coveralls": "^3.0.3",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.10.0",
"jest": "^24.1.0",
"jest": "^25.1.0",
"jest-environment-jsdom": "^25.1.0",
"lodash": "4.17.15",
"mobx": "^5.13.0",
"mobx-react": "^6.1.3",
"np": "^5.1.0",
"mobx-react": "^6.1.8",
"np": "^5.0.0",
"numeral": "^2.0.6",
"react": "16.12.0",
"react-dom": "^16.8.3",
"regenerator-runtime": "^0.13.1",
"rollup": "^1.4.1",
"rollup": "^1.31.1",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-peer-deps-external": "^2.2.0",
"rollup-plugin-peer-deps-external": "^2.2.2",
"source-map-explorer": "^2.0.1",
"tslint": "^5.13.1",
"tslint": "^6.0.0",
"typescript": "^3.3.3333"
},
"dependencies": {
"classnames": "^2.2.6",
"date-fns": "^1.30.1",
"date-fns": "^2.9.0",
"decimal.js": "^10.1.1",
"fast-memoize": "^2.5.1",
"html-react-parser": "0.10.0",
"html-react-parser": "0.10.1",
"iso8601-duration": "^1.1.7",
"moment": "^2.24.0",
"numeral": "^2.0.6"
Expand Down
6 changes: 3 additions & 3 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import Decimal from 'decimal.js';
export const EMPTY_FIELD = '--';

export const DATE_FORMATS: { date: string, date_at_time: string, date_value: string } = {
date: 'MM/DD/YY',
date_at_time: 'MM/DD/YY @ h:mmA', // ex. 07/14/16 @ 2:24PM
date_value: 'YYYY-MM-DD',
date: 'LL/dd/yy',
date_at_time: 'LL/dd/yy @ h:mma', // ex. 07/14/16 @ 2:24PM
date_value: 'yyyy-LL-dd',
};

export const CENT_DECIMAL = new Decimal('100');
Expand Down
4 changes: 2 additions & 2 deletions src/formatting.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { parse } from 'iso8601-duration';
import { format as dateFnsFormat } from 'date-fns';
import { format as dateFnsFormat, parseISO } from 'date-fns';
import numeral from 'numeral';
import parser from 'html-react-parser';
import memoize from 'fast-memoize';
Expand Down Expand Up @@ -96,7 +96,7 @@ export function formatPhoneNumber (input?: string | null) {

export function formatDate (value?: string | null, dateFormat = DATE_FORMATS.date) {
if (!hasStringContent(value)) { return EMPTY_FIELD; }
return dateFnsFormat(value, dateFormat);
return dateFnsFormat(parseISO(value), dateFormat);
}

export function formatDateTime (value?: string | null) {
Expand Down
Loading

0 comments on commit 5e736ac

Please sign in to comment.