I'm currently working on a project and I was wondering if it's feasible in JavaScript to invoke new Date() for a specific timezone. So when I declare:
var test = new Date();
Upon debugging, I notice that the variable test =
Date {Fri Nov 07 2014 11:59:41 GMT-0500 (Eastern Standard Time)}
This is expected since I am located in the Eastern Time Zone and it's currently 11:59 here.
Now, my query is: Is there a method to acquire the Date object for a designated time zone, rather than relying solely on your local system time?
I have a reservation form where I validate the entered start time of a conference against the current time to prevent users from entering a past time or one within 2 hours of the present time (different error messages pop up based on each scenario).
The challenge arises when the person completing the form could be situated in Eastern, Central, Mountain, or Pacific time zones. For instance, if someone in Eastern Time submits a form for a conference with a start time in Mountain time, using new Date() only provides me with my local time for comparison, whereas I would need it to align with Mountain time for validation purposes.
It might sound a bit complex, but I wanted to offer some context regarding this issue related to the application. If further explanation is needed, please don't hesitate to ask. Your assistance is highly appreciated.
Thank you!
-Dave