Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly compare dates for PR retrieval; fix tests #301

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/src/Gren.js
Expand Up @@ -430,7 +430,7 @@ class Gren {
const { headers: { link }, data: prs } = results;
const totalPages = this._getLastPage(link);
const filterPrs = prs.filter(pr => pr.merged_at);
if (prs.length > 0 && since < prs[prs.length - 1].updated_at &&
if (prs.length > 0 && since < (new Date(prs[prs.length - 1].updated_at)) &&
totalPages && +page < totalPages) {
return this._getMergedPullRequests(since, page + 1).then(prsResults => prsResults.concat(filterPrs));
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/_utils.js
Expand Up @@ -160,7 +160,7 @@ function convertStringToArray(arrayLike) {
* @return {string}
*/
function formatDate(date) {
return ('0' + date.getDate()).slice(-2) + '/' + ('0' + (date.getMonth() + 1)).slice(-2) + '/' + date.getFullYear();
return ('0' + date.getUTCDate()).slice(-2) + '/' + ('0' + (date.getUTCMonth() + 1)).slice(-2) + '/' + date.getUTCFullYear();
}

/**
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -4,6 +4,7 @@
"description": "Create a release from a tag and uses issues or commits to creating the release notes. It also can generate a CHANGELOG.md file based on the release notes (or generate a brand new).",
"main": "./github-release-notes.js",
"scripts": {
"build": "gulp build",
"start": "node github-release-notes.js",
"test": "./node_modules/.bin/nyc mocha --reporter=nyan --compilers=js:babel-register",
"coverage": "nyc --reporter=lcov --reporter=text mocha --compilers=js:babel-register",
Expand Down
8 changes: 3 additions & 5 deletions test/Gren.spec.js
Expand Up @@ -220,12 +220,10 @@ describe('Gren', () => {
'Others:': ['closed']
};

gren.options.groupPostProcessor = (groupContent) => {
return groupContent.replace(0, groupContent.indexOf(':\n') + 3);
}
gren.options.groupPostProcessor = (groupContent) => groupContent.replace(0, groupContent.indexOf(':\n') + 3);

assert.deepEqual(gren._groupBy(normal), [`Test:`], 'Passing one heading for one issue');
assert.deepEqual(gren._groupBy(noLabel), [`Others:`], 'Group option is "label" with no labels');
assert.deepEqual(gren._groupBy(normal), [`Test:\nIssue with one label and milestone`], 'Passing one heading for one issue');
assert.deepEqual(gren._groupBy(noLabel), [`Others:\nIssue with no milestone and no labels`], 'Group option is "label" with no labels');
});
});

Expand Down