The problem is that dateit is not String, it is a Date instance of the object. Therefore, you cannot use split on it. To use it, you can first convert it to String. For example, like him:
$scope.test = function(date) {
date = date.toString();
$scope.d = (date.split(' ')[0]);
$scope.m = (date.split(' ')[1]);
$scope.y = (date.split(' ')[2]);
$scope.dd = (date.split(' ')[3]);
};
When consolidating a journal, console.log(date);it automatically calls toString, so for you it looks like a string.
, split . Date, getMonth, .getFullYear ..