function getField(data, path) {
	var steps = path.split('.');
	for (var i = 0; i < steps.length; i++) {
		var step = steps[i];
		if (typeof data !== 'object' || typeof data[step] === 'undefined') {
			throw 'Required field was not found: ' + path;
		}

		data = data[step];
	}

	return data;
}

var data = JSON.parse(value),
	lastlogin = getField(data,'ocs.data.lastLogin');

if (lastlogin === '0')
	return -1

return Math.floor((Date.now() - lastlogin) / 1000 / 86400);