fix java.time object handling (with added tests)