-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #745 from zurichat/staging
Moving staging to main for production release
- Loading branch information
Showing
10 changed files
with
80 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,3 +102,4 @@ dist | |
|
||
# TernJS port file | ||
.tern-port | ||
backend/package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,8 +40,8 @@ | |
"react-dom": "//cdn.jsdelivr.net/npm/[email protected]/umd/react-dom.production.min.js", | ||
"@zuri/root-config": "//chess.zuri.chat/zuri-root-config.js", | ||
"@zuri/zuri-plugin-chessboard": "//chess.zuri.chat/zuri-zuri-plugin-chessboard.js", | ||
"@zuri/utilities": "//zuri.chat/zuri-utilities.js", | ||
"@zuri/plugin-header": "//zuri.chat/zuri-plugin-header.js" | ||
"@zuri/utilities": "//staging.zuri.chat/zuri-utilities.js", | ||
"@zuri/plugin-header": "//staging.zuri.chat/zuri-plugin-header.js" | ||
} | ||
} | ||
</script> | ||
|
@@ -57,8 +57,8 @@ | |
"@single-spa/welcome": "//unpkg.com/single-spa-welcome/dist/single-spa-welcome.js", | ||
"@zuri/root-config": "//chess.zuri.chat/zuri-root-config.js", | ||
"@zuri/zuri-plugin-chessboard": "//chess.zuri.chat/zuri-zuri-plugin-chessboard.js", | ||
"@zuri/utilities": "//zuri.chat/zuri-utilities.js", | ||
"@zuri/plugin-header": "//zuri.chat/zuri-plugin-header.js" | ||
"@zuri/utilities": "//staging.zuri.chat/zuri-utilities.js", | ||
"@zuri/plugin-header": "//staging.zuri.chat/zuri-plugin-header.js" | ||
} | ||
} | ||
</script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ react-dom | |
https://cdn.jsdelivr.net/npm/[email protected]/umd/react-dom.production.min.js | ||
|
||
@zuri/utilities | ||
https://zuri.chat/zuri-utilities.js | ||
https://staging.zuri.chat/zuri-utilities.js | ||
|
||
@zuri/plugin-header | ||
https://zuri.chat/zuri-plugin-header.js | ||
https://staging.zuri.chat/zuri-plugin-header.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
export default (timeStamp) => { | ||
let mappedTimeStamp = ''; | ||
const [date, time, suffix] = timeStamp.split(' '); | ||
const [month, day, year] = date.split('/'); | ||
const [hr, min, sec] = time.split(':'); | ||
const currentDate = new Date( | ||
new Date().toLocaleString('en-US', { | ||
timeZone: 'UTC', | ||
}), | ||
); | ||
const commentDate = suffix === 'PM' | ||
? new Date(year.replace(',', ''), Number(month) - 1, day, Number(hr) + 12, min, sec) | ||
: new Date(year.replace(',', ''), Number(month) - 1, day, hr, min, sec); | ||
const diff = currentDate - commentDate; | ||
const diffObj = { | ||
second: diff / 1000, | ||
minute: diff / 1000 / 60, | ||
hour: diff / 1000 / 60 / 60, | ||
day: diff / 1000 / 60 / 60 / 24, | ||
week: diff / 1000 / 60 / 60 / 24 / 7, | ||
month: diff / 1000 / 60 / 60 / 24 / 7 / 4, | ||
year: diff / 1000 / 60 / 60 / 24 / 7 / 4 / 12, | ||
}; | ||
Object.keys(diffObj).forEach((key) => { | ||
const value = Math.floor(diffObj[key]); | ||
if (value === 1) { | ||
mappedTimeStamp = `${value} ${key} ago`; | ||
} else if (value > 1) { | ||
mappedTimeStamp = `${value} ${key}s ago`; | ||
} | ||
}); | ||
return mappedTimeStamp; | ||
}; |