Fix: incorrect datetime parsing and related tests

Fix for jira issue APIS-391