Skip to content

Commit

Permalink
Fix onAuditLog (#707)
Browse files Browse the repository at this point in the history
* Fix onAuditLog

* Move millesecond clear to getAuditLog - you shouldn't rely on them
  • Loading branch information
Neztore authored Aug 7, 2023
1 parent 33159f2 commit 8314b1a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/groups/getAuditLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ function getAuditLog (group, actionType, userId, sortOrder, limit, cursor, jar)
reject(new Error(error))
} else {
responseData.data = responseData.data.map((entry) => {
// We need to set milliseconds to 0 because Roblox does this fascinating thing
// Where they vary the ms value on each request, for an existing action.
entry.created = new Date(entry.created)
entry.created.setMilliseconds(0)
return entry
})
resolve(responseData)
Expand Down
3 changes: 2 additions & 1 deletion lib/groups/onAuditLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ exports.func = function (args) {
if (audit) {
for (const key in audit.data) {
if (Object.prototype.hasOwnProperty.call(audit.data, key)) {
const date = new Date(audit.data[key].created.slice(0, audit.data[key].created.lastIndexOf('.')))
const date = audit.data[key].created

if (date > latest) {
latest = date
given.push(audit.data[key])
Expand Down

0 comments on commit 8314b1a

Please sign in to comment.