life-commit icon indicating copy to clipboard operation
life-commit copied to clipboard

TimeStamps not sorted correctly

Open khannavidur opened this issue 7 years ago • 1 comments

My commit file looks something like -

[
 {
  "lifemoji": "💪",
  "title": "100DaysOfML Challenge Begins",
  "message": "Today I embarked on a challenge to understand and work on Machine Learning",
  "date": "2018-08-01T07:22:43.600Z",
  "id": "49aefe23-ccc3-448c-9bd3-16a96cad39b9"
 },
 {
  "lifemoji": "✅",
  "title": "Downloaded Prof. Gilbert' book",
  "message": "Downloaded \"Introduction to Linear Algebra\" by Gilbert Strang",
  "date": "2018-08-01T08:59:45.823Z",
  "id": "63605e54-faf8-4985-b93a-4d2e1a714447"
 }
]

As per it, "100DaysOfML Challenge Begins" must appear before "Downloaded Prof. Gilbert' book" but that does not happen.

Node JS Version - 8.11.3

I think I found the issue. It' in the gulpfile.js on line 22. It should be

if (new Date(c1.date.input).getTime() < new Date(c2.date.input).getTime()) return -1; 

instead of

if (new Date(c1.date).getTime() < new Date(c2.date).getTime()) return -1;

This resolves it for me.

khannavidur avatar Aug 01 '18 17:08 khannavidur

PR - https://github.com/ByronHsu/life-commit/pull/19

khannavidur avatar Aug 01 '18 18:08 khannavidur