-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert dates used in the activity log api calls to UTC (#2692)
  Fixes #2476 Fixes #2477
- Loading branch information
1 parent
5ebbb4a
commit c81aafe
Showing
5 changed files
with
34 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import moment from "moment"; | ||
|
||
// This assumes the date passed in the param has a format of YYYY-MM-DD | ||
export const toUTC = (originalDate: string) => { | ||
if (!originalDate || !moment(originalDate).isValid) return; | ||
|
||
const [year, month, date] = originalDate.split("-"); | ||
|
||
if (isNaN(Number(year)) || isNaN(Number(month)) || isNaN(Number(date))) | ||
return; | ||
|
||
return moment() | ||
.year(Number(year)) | ||
.month(Number(month) - 1) | ||
.date(Number(date)) | ||
.utc() | ||
.format("L"); | ||
}; |
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