Force date formatting to stay in UTC.
This commit is contained in:
parent
d2f9ea3bea
commit
53fb11e9c2
1 changed files with 4 additions and 3 deletions
|
|
@ -282,11 +282,12 @@ export default {
|
|||
var returnValue = null;
|
||||
|
||||
try {
|
||||
// Avoid any UTC / local time issues by always treating the input and output as UTC.
|
||||
const date = new Date(dateString);
|
||||
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
const year = date.getUTCFullYear();
|
||||
const month = String(date.getUTCMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getUTCDate()).padStart(2, "0");
|
||||
|
||||
returnValue = `${year}-${month}-${day}`;
|
||||
} catch ( error ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue