Skip to content

Commit

Permalink
Merge pull request #250 from lelylan/feature/update-library-datefns
Browse files Browse the repository at this point in the history
[update-library-datefns] Upgrade date-fns library to v2
  • Loading branch information
jonathansamines authored Sep 20, 2019
2 parents 9722f34 + 0a76e85 commit 7210f7d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Next
### Dependencies upgrades

* Upgrade date-fns library to v2

## 2.4.0
### Dependencies upgrades

Expand Down
2 changes: 1 addition & 1 deletion lib/access-token/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const isAfter = require('date-fns/is_after');
const isAfter = require('date-fns/isAfter');
const parseToken = require('./parse-token');
const coreModule = require('./../core');

Expand Down
8 changes: 4 additions & 4 deletions lib/access-token/parse-token.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
'use strict';

const debug = require('debug')('access-token');
const isDate = require('date-fns/is_date');
const parse = require('date-fns/parse');
const addSeconds = require('date-fns/add_seconds');
const isDate = require('date-fns/isDate');
const parseISO = require('date-fns/parseISO');
const addSeconds = require('date-fns/addSeconds');

const parseTokenDateProperties = (token) => {
const parsedTokenProps = {};

if ('expires_at' in token) {
if (!isDate(token.expires_at)) {
parsedTokenProps.expires_at = parse(token.expires_at);
parsedTokenProps.expires_at = parseISO(token.expires_at);
}
} else if ('expires_in' in token) {
parsedTokenProps.expires_at = addSeconds(
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
],
"dependencies": {
"@hapi/joi": "^15.1.1",
"date-fns": "^1.3.0",
"date-fns": "^2.2.1",
"debug": "^4.1.1",
"wreck": "^14.0.2"
},
Expand Down

0 comments on commit 7210f7d

Please sign in to comment.