My application heavily relines on time being on pacific time If I deploy my application on Google App Engine (US-WEST region), the time that is calculated by the cloud app engine is different than my local machine.
I've tried using Moment-Timezone to make it force the cloud server machine to use los angeles time format however its still giving me a different time than my local machine.
Is there a way to use moment so that the time values are consistent no matter where its deployed? Or did I implement the moment-time zone incorrectly?
const test = moment(new Date(filteredTimeLeft))
const endTime = test.tz('America/Los_Angeles').unix();
console.log('endTime', endTime)
const convertSec = Number(coin.seconds);
console.log('convertSec', convertSec)
const newDate = moment(new Date())
const calcTime = endTime - convertSec - newDate.tz('America/Los_Angeles').unix();
Not sure how you came with usin the plain JS new Date along with moment, nor the use of unix().
And I don't know what coin.seconds can be...
Anyway, here an example showing
let js_date = new Date();
console.log("Plain JS date", js_date);
let moment_UTC = moment().utc();
console.log("UTC time", moment_UTC.format("hh:mm:ss"));
let moment_local = moment();
console.log("Your local time", moment_local.format("hh:mm:ss"));
let moment_Los_Angeles = moment().tz('America/Los_Angeles');
console.log("Los Angeles", moment_Los_Angeles.format("hh:mm:ss"));
let moment_New_York = moment().tz('America/New_York');
console.log("New York", moment_New_York.format("hh:mm:ss"));
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
<script src="https://momentjs.com/downloads/moment-timezone-with-data.js"></script>