UNPKG

@fecp/mobile

Version:

85 lines (84 loc) 2.51 kB
const parseDateFormatter = (textFormatType, columnsType) => { const columnsTypeArr = columnsType.split(","); if (columnsTypeArr.length == 1) { if (textFormatType == "3") { return "YYYY年"; } return "YYYY"; } else if (columnsTypeArr.length == 2) { if (textFormatType == "0") { return "YYYYMM"; } else if (textFormatType == "1") { return "YYYY-MM"; } else if (textFormatType == "2") { return "YYYY/MM"; } else if (textFormatType == "3") { return "YYYY年MM月"; } } else if (columnsTypeArr.length == 3) { if (textFormatType == "0") { return "YYYYMMDD"; } else if (textFormatType == "1") { return "YYYY-MM-DD"; } else if (textFormatType == "2") { return "YYYY/MM/DD"; } else if (textFormatType == "3") { return "YYYY年MM月DD日"; } } else if (columnsTypeArr.length == 4) { if (textFormatType == "0") { return "YYYYMMDD HH"; } else if (textFormatType == "1") { return "YYYY-MM-DD HH"; } else if (textFormatType == "2") { return "YYYY/MM/DD HH"; } else if (textFormatType == "3") { return "YYYY年MM月DD日 HH"; } } else if (columnsTypeArr.length == 5) { if (textFormatType == "0") { return "YYYYMMDD HH:mm"; } else if (textFormatType == "1") { return "YYYY-MM-DD HH:mm"; } else if (textFormatType == "2") { return "YYYY/MM/DD HH:mm"; } else if (textFormatType == "3") { return "YYYY年MM月DD日 HH:mm"; } } else if (columnsTypeArr.length == 6) { if (textFormatType == "0") { return "YYYYMMDD HH:mm:ss"; } else if (textFormatType == "1") { return "YYYY-MM-DD HH:mm:ss"; } else if (textFormatType == "2") { return "YYYY/MM/DD HH:mm:ss"; } else if (textFormatType == "3") { return "YYYY年MM月DD日 HH时mm分ss秒"; } } }; const parseTimeFormatter = (textFormatType, columnsType) => { const columnsTypeArr = columnsType.split(","); if (columnsTypeArr.length == 1) { if (textFormatType == "1") { return "HH时"; } return "HH"; } else if (columnsTypeArr.length == 2) { if (textFormatType == "0") { return "HH:mm"; } else if (textFormatType == "1") { return "HH时mm分"; } } else if (columnsTypeArr.length == 3) { if (textFormatType == "0") { return "HH:mm:ss"; } else if (textFormatType == "1") { return "HH时mm分ss秒"; } } }; export { parseDateFormatter, parseTimeFormatter };