Difference difference in script include

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2024 02:06 AM
Hi,
I have some unexpected behavior with dates. It's probably due to the time zone.
checkIfDateIsCHforBRUandLUX: function(){
var inputDate = this.getParameter('sysparm_date');
gs.log('DWPCatalogClientUtils | checkIfDateIsCH | inputDate = ' + inputDate);
var user = this.getParameter('sysparm_requested_for');
var date = new GlideDate();
gs.log('DWPCatalogClientUtils | checkIfDateIsCH | Today = ' + date);
date.setDisplayValue(inputDate,'dd/MM/yyyy');
gs.log('DWPCatalogClientUtils | checkIfDateIsCH | New date = ' + date);
},
The output =
DWPCatalogClientUtils | checkIfDateIsCH | inputDate = 01/05/2024
DWPCatalogClientUtils | checkIfDateIsCH | New date = 2024-04-30
DWPCatalogClientUtils | checkIfDateIsCH | Today = 2024-03-18
Why is there a difference of 1 day between 'inputDate' and 'New date'? How can I fix this?
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2024 02:19 AM
Hi @Tomi Corigliano the below will give you in user's time zone
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2024 02:59 AM
Its working as expected for me. Please find below snapshot, How I have verified in BG Script
I would suggest you to please check users date format and set it as per below snapshot. Profile setting >> Preferences >> Language and region
If this solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.
Feel free to connect with me on LinkedIn.
Best Regards,
Krushna Birla
Senior Software Engineer
Globant, Pune