- 
    Type:Bug Report 
- 
    Resolution: Fixed
- 
    Priority:L3 - Default 
- 
    Affects Version/s: None
- 
    Component/s: external task client js
- 
    None
Steps to reproduce:
- deploy a process with a external task (with topic name foo)
- start an instance and pass a variable bar from type date
- subscribe to the topic foo
client.subscribe("foo", function({ task, taskService }) { const dateValue = task.variables.get('bar'); ... }); 
Actual Behavior:
- the handler is not invoked
- the deserialization of the date variable fails with following exception:
✖ polling failed with TypeError: value.toISOString is not a function 
Expected Behavior:
- the date variable is deserialized properly and a date is returned
- the handler is always invoked, the deserialization of the variable happens only, when the user tries to get the variable
Additional:
The documentation [1] says, that dates are always available in the string format, which might be confusing, when someone does the following:
client.subscribe("foo", function({ task, taskService }) { const variables = new Variables(); variables.set('dateValue', new Date()); const dateValue = variables.get('dateValue'); // <-- returns a date object ... });
There should be just one way, how a date variable is deserialized.
[1]: https://github.com/camunda/camunda-external-task-client-js/blob/master/docs/Variables.md#date