import Vue from 'vue'

Vue.filter('hideTel', function(phone){
	if(!phone){
		return '';
	}
	return phone.toString().replace(/^(\d{3})\d{4}(\d+)/,"$1****$2");
});

// Vue.filter('hideIDcard', function(cardId){
// 	if(!cardId){
// 		return '';
// 	}
// 	return cardId.toString().replace(/(?<=\d{3})\d{12}(?=\d{2})/,"************");
// });

Vue.filter('formatBirth', function(birth){
	if(!birth){
		return '';
	}
	return birth.split(' ')[0];
});

Vue.filter('formatTime', function(pay_time){
	if(!pay_time){
		return '';
	}
	let date = pay_time.split(' ')[0];
	let time = pay_time.split(' ')[1];
	return date.split('-')[1] + '月' + date.split('-')[2] + '日 ' + time.split(':')[0] + ':' + time.split(':')[1];
});
