From f1b742dff4cb3175f1c726aeab43fd7581e7e27a Mon Sep 17 00:00:00 2001 From: Jarzon Date: Tue, 31 Jan 2017 06:26:11 -0500 Subject: [PATCH] Adding Chrono to parse relative date --- components/groups.js | 3 ++- package.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/groups.js b/components/groups.js index 2ecdaaa..884b53d 100644 --- a/components/groups.js +++ b/components/groups.js @@ -2,6 +2,7 @@ var SteamCommunity = require('../index.js'); var SteamID = require('steamid'); var xml2js = require('xml2js'); var Cheerio = require('cheerio'); +var chrono = require('chrono-node'); SteamCommunity.prototype.getGroupMembers = function(gid, callback, members, link, addresses, addressIdx) { members = members || []; @@ -545,7 +546,7 @@ SteamCommunity.prototype.getAllGroupComments = function(gid, from, count, callba cachedSelector = $(this).find(".commentthread_author_link"); comment.authorName = $(cachedSelector).find("bdi").text(); comment.authorId = $(cachedSelector).attr('href').replace("http://steamcommunity.com/id/", ""); - comment.date = $(this).find(".commentthread_comment_timestamp").text().trim(); + comment.date = chrono.parseDate($(this).find(".commentthread_comment_timestamp").text().trim()); cachedSelector = $(this).find(".commentthread_comment_text"); diff --git a/package.json b/package.json index de07d9d..1e85f29 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "xml2js": "^0.4.11", "cheerio": "0.22.0", "async": "^2.1.4", - "steam-totp": "^1.3.0" + "steam-totp": "^1.3.0", + "chrono-node": "^1.2.5" }, "engines": { "node": ">=4.0.0"