This repository was archived by the owner on Nov 8, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +16
-8
lines changed
Expand file tree Collapse file tree 4 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -80,8 +80,11 @@ when it breaks.
8080
8181## Changelog
8282
83+ ** 2.1.0** (2018-06-25):
84+ * Exported helper function ` prevDay() ` .
85+
8386** 2.0.0** (2018-06-25):
84- * Exported some helper functions.
87+ * Exported helper functions ` stringToDate() ` and ` dateToString() ` .
8588
8689** 1.0.0** (2018-06-11):
8790 * Support for passing a GitHub API key.
Original file line number Diff line number Diff line change @@ -52,4 +52,8 @@ console.log(date); // 2018-05-11T00:00:00.000Z
5252
5353const dateString = githubContribs .dateToString (date);
5454console .log (dateString); // 2018-05-11
55+
56+ const dayBefore = githubContribs .prevDay (date); // Date() object
57+ const dayBeforeString = githubContribs .dateToString (dayBefore);
58+ console .log (dayBeforeString); // 2018-05-10
5559```
Original file line number Diff line number Diff line change 3333 return date . toISOString ( ) . substring ( 0 , 10 ) ;
3434 } ;
3535
36+ // See https://stackoverflow.com/a/25114400/1855917
37+ const prevDay = date => {
38+ return new Date ( date . getTime ( ) - ( 24 * 60 * 60 * 1000 ) ) ;
39+ } ;
40+
3641 module . exports = {
3742 fetch : fetchContribs ,
3843 stringToDate,
39- dateToString
44+ dateToString,
45+ prevDay
4046 } ;
4147
4248 const fetchRetry = url => {
205211 return result ;
206212 } ;
207213
208- // See https://stackoverflow.com/a/25114400/1855917
209- const prevDay = date => {
210- return new Date ( date . getTime ( ) - ( 24 * 60 * 60 * 1000 ) ) ;
211- } ;
212-
213214} ) ( ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @ghuser/github-contribs" ,
3- "version" : " 2.0 .0" ,
3+ "version" : " 2.1 .0" ,
44 "description" : " List all GitHub repos a user has contributed to since the beginning of time." ,
55 "license" : " Unlicense" ,
66 "repository" : {
You can’t perform that action at this time.
0 commit comments