GlideDateTime.getValue doesn't work correctly when using variable substitution


GlideDateTime.getValue API does not work correctly when using variable substitutions

Steps to Reproduce

1. HOP into demonightlyLondon
2. Go to System - Definition -> Scripts - Background
3. Run the following Script
var gdt = new GlideDateTime();
gs.debug('typeof gdt.getValue(): {0}', typeof gdt.getValue());
gs.debug('Sample message using concatenation: ' + gdt.getValue());
gs.debug('Sample message using substitution: {0}', gdt.getValue());

Expected behavior: The third gs.debug statement should print the value of the variable after substitution.
Actual behavior: The following message is printed out.
*** Script: [DEBUG] Sample message using substitution: org.mozilla.javascript.NativeJavaObject@7629855e


The feature is working as expected as per currently supported functionality.

A possible option that could be used is to append the function call with an empty string similar to below example: 

gs.debug('Substitution: {0}', gdt.getValue()+'');

Related Problem: PRB1319836