Genesys CTI User Forum
Genesys CTI User Forum => Genesys-related Development => Topic started by: cavagnaro on November 21, 2020, 01:02:36 AM
-
Hi guys
Any of you have a sample on how to use these functions and which format do they support?
I am having problems trying to use them with the format 20201120T204713 for example-
Thanks
-
Hi,
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
describes the iso 8601 format, looking at that it seems the interpreter expects ':' separating hour, minute, second and '.' separating second and millisecond, and a 'z' as last character.
Based on that I think you have to preprocess your datetime-string if you want to use those functions.
Br
Skickat från min Mi MIX 3 5G via Tapatalk
-
Hi was able to make it work
String format from customer has to be strictly YYYY-MM-DDTHH:MM:SS.sssZ
Customer was just sending YYYY-MM-DDTHH:MM:SS
Added ".sssZ"
and then did a var datef = Date.fromISOString(f);
Now it is a valid Date object
Thanks
-
Ok an issue with this is that it return the date in GMT zone and the TZ in another field...
So...just another complication.
Will do as a JSP file better...just to consider if someone decides to use this...
-
If you always deal with a timezone with a fixed offset from gmt you should be able to change .000Z to .000+02:00 (to offset utc by two hours).
I haven't tried it in composer but if the js-function conforms to iso standard it should be able to handle that format.
You say that timezone is in a different field, maybe you can have an object to select "suffix" based on the contents in that field prior to adding that to the given datestring to produce a valid datetime?
Jsp is of course another way to achieve the same thing.
Skickat från min Mi MIX 3 5G via Tapatalk
-
I see, will try it anyways to have it documented
Thanks!