fix/getDateEST

This commit is contained in:
SowinskiBraeden committed 2023-09-01 00:17:43 -07:00
1 parent d56ca83e1f
commit 8a1fabc336
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "dayz-armbands", "name": "dayz-armbands",
"version": "8.10.4", "version": "8.10.5",
"description": "A General Purpose Discord Bot for DayZ Servers.", "description": "A General Purpose Discord Bot for DayZ Servers.",
"main": "index.js", "main": "index.js",
"nodemonConfig": { "nodemonConfig": {
+1 -1
View File
@@ -107,7 +107,7 @@ class DayzArmbands extends Client {
async getDateEST(time) { async getDateEST(time) {
let t = new Date(); // Get current date (PST) let t = new Date(); // Get current date (PST)
let e = new Date(t.getTime() + 180*60*1000); // Convert to EST to ensure the date is correct for the applied EST time let e = new Date(t.getTime() + 180*60*1000); // Convert to EST to ensure the date is correct for the applied EST time
let n = new Date(`${e.getFullYear()}-${e.getMonth()<10?'0':''}${e.getMonth()+1}-${e.getDate()}T${time.split(' ')[0]}`) // Apply given time to EST date let n = new Date(`${e.getFullYear()}-${e.getMonth()<10?'0':''}${e.getMonth()+1}-${e.getDate()<10?'0':''}${e.getDate()}T${time.split(' ')[0]}`) // Apply given time to EST date
let f = new Date(n.getTime() - 180*60*1000) // Convert back to PST let f = new Date(n.getTime() - 180*60*1000) // Convert back to PST
return f; return f;
} }