Skip to content

Commit

Permalink
Merge 73d5946 into a413c30
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienMalige committed Dec 26, 2019
2 parents a413c30 + 73d5946 commit 8646bf9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ const parseData = function (data) {
})
}

var parisGMT = utils.getParisGMT();

output.push(new item.Item({
title: entry.subject,
description: entry.body,
Expand All @@ -339,8 +341,8 @@ const parseData = function (data) {
location: entry.location,
urgent: entry.urgent ? entry.urgent : false,
price: entry.price ? entry.price[0] : 0,
date: new Date(entry.first_publication_date),
date_index: new Date(entry.index_date),
date: new Date(entry.first_publication_date + " " + parisGMT),
date_index: new Date(entry.index_date + " " + parisGMT),
owner: entry.owner,
attributes: attributes
}));
Expand Down
7 changes: 6 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ module.exports.requestHeaders = {
'Content-Type': 'application/json',
'Referer': "https://www.leboncoin.fr/recherche/",
'Origin': 'https://www.leboncoin.fr'
}
};
module.exports.getParisGMT = function() {
var d = new Date();
var s = d.toLocaleString(undefined, { timeZone: "Europe/Paris", timeZoneName: "short" });
return s.slice(-5)
};

0 comments on commit 8646bf9

Please sign in to comment.