How to display same time for every time zone users?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello Community,
We have a field 'date' (type:date) in record producer. When user submits the record producer there are two variable 'start date' and 'end date' which sets it as date + currentTime and date +'23:59:59' respectively. The issue is that the script is that producer scripting is setting this end date and it's not working as expected. For every user irrespective of time zone, the end date time should be ''23:59:59'. Below is the producer script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Seems your script is failing is that pdate.getDate() returns a Date part in the system's internal format (GMT), while concatenating " 23:59:59" to it creates a string that the system might misinterpret based on your user session's timezone.
please find the updated script:
current.type = "one_day";
current.user = producer.requested_for;
var endGdt = new GlideDateTime();
endGdt.setDisplayValue(producer.date + " 23:59:59");
current.end = endGdt;
var selectedDate = new GlideDate();
selectedDate.setValue(producer.date);
var todayDate = new GlideDate();
if (selectedDate.getValue() == todayDate.getValue()) {
current.status = "active";
current.start = new GlideDateTime();
} else {
current.status = "inactive";
var startGdt = new GlideDateTime();
startGdt.setDisplayValue(producer.date + " 00:00:00");
current.start = startGdt;
}
gs.addInfoMessage(gs.getMessage("Thank you! The booking was successful."));
