/**
* format time depend on the offer timestamp or Date instance
* @param {Number, Date } date 要转换的日期
* @param {String} format 字符串日期格式 default 'DD/MM/YYYY HH:mm'
* @param {Boolean} instance describe 配置项, 如果为true 返回转换后的日期对象实例 default false
*/
const dateUtil = require('fecha');
export function formatZoneDate (date, format, instance = false) {
var isValid = new Date(date).toString() === 'Invalid Date';
if (isValid) throw new TypeError('Offer an illegal value {date} to format');
var getInstance = instance || false;
if (!isValid) {
var transformTiem = new Date(date).getTime();
if (!getInstance) {
return dateUtil.format(new Date(transformTiem), format || 'DD/MM/YYYY');
}
return new Date(transformTiem);
}
// var mm
// var timeZone = getStore('timeZone')
// var value = (date instanceof Date) ? Number(date) : date
// if (timeZone === 'UTC+8') {
// mm = value + hour * 8
// } else if (timeZone === 'UTC+9') {
// mm = value + hour * 9
// }
// return (date instanceof Date)
// ? new Date(mm)
// : dateUtil.format(new Date(mm), format || 'DD/MM/YYYY HH:mm')
}