Commit 5d8895da authored by Sandro Lutz's avatar Sandro Lutz Committed by Sandro Lutz
Browse files

Fix publish time calculations

parent e6fbf38e
...@@ -102,7 +102,11 @@ export default class JobofferList extends FilteredListPage { ...@@ -102,7 +102,11 @@ export default class JobofferList extends FilteredListPage {
_renderItem(joboffer, list, selectedId) { _renderItem(joboffer, list, selectedId) {
const animationDuration = 300; // in ms const animationDuration = 300; // in ms
const imageurl = apiUrl + joboffer.logo.file; const imageurl = apiUrl + joboffer.logo.file;
const days = Math.ceil((Date.now() - Date.parse(joboffer._created)) / (1000 * 3600 * 24)); const dayFactor = 1000 * 3600 * 24;
// Set createdDay to timestamp with hour set to 0 to ensure
// correct time phrase rendering (today, yesterday, etc.)
const createdDay = Math.floor(Date.parse(joboffer._created) / dayFactor);
const days = Math.floor(Date.now() / dayFactor) - createdDay;
let datePhrase; let datePhrase;
if (days === 0) { if (days === 0) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment