Commit c28b039a authored by lshan's avatar lshan

测试

parent f24a082e
...@@ -20,6 +20,27 @@ export function transfterStrToDate(str: string) { ...@@ -20,6 +20,27 @@ export function transfterStrToDate(str: string) {
end = `${d.getFullYear()} ${d.getMonth() + 1} ${d.getDate()} ${end}` end = `${d.getFullYear()} ${d.getMonth() + 1} ${d.getDate()} ${end}`
const startDate = new Date(start) const startDate = new Date(start)
const endDate = new Date(end) const endDate = new Date(end)
console.log(start,'start');
return [startDate, endDate]
} else {
return undefined
}
}
// 早上9:00 下午17:00
export function transfterStrToDateSafari(str: string) {
const arr = str.split(' ')
if (arr.length === 2) {
let [start, end] = arr
start = start.replace(':', ':').replace('早上', '').replace('下午', '')
end = end.replace(':', ':').replace('早上', '').replace('下午', '')
const d = new Date()
start = `${d.getFullYear()}/${d.getMonth() + 1}/${d.getDate()} ${start}`
end = `${d.getFullYear()}/${d.getMonth() + 1}/${d.getDate()} ${end}`
const startDate = new Date(start)
const endDate = new Date(end)
console.log(start,'start');
console.log(end,'end');
return [startDate, endDate] return [startDate, endDate]
} else { } else {
return undefined return undefined
......
...@@ -470,6 +470,7 @@ import transferTimeStampToMoment, { ...@@ -470,6 +470,7 @@ import transferTimeStampToMoment, {
getOpeningHoursFromMoment, getOpeningHoursFromMoment,
getWeekendStatusFromArr, getWeekendStatusFromArr,
transfterStrToDate, transfterStrToDate,
transfterStrToDateSafari
} from "@/utils/time/transfer"; } from "@/utils/time/transfer";
import { getSelfOutLet } from "@/utils/outlet/index"; import { getSelfOutLet } from "@/utils/outlet/index";
import { getUserMsg } from "@/utils/userMsg/userMsg"; import { getUserMsg } from "@/utils/userMsg/userMsg";
...@@ -780,7 +781,8 @@ export default Vue.extend({ ...@@ -780,7 +781,8 @@ export default Vue.extend({
this.formData.openDays.push("6"); this.formData.openDays.push("6");
this.formData.openDays.push("7"); this.formData.openDays.push("7");
} }
const arr2 = transfterStrToDate(record.opening_hours); // const arr2 = transfterStrToDate(record.opening_hours);
const arr2 = transfterStrToDateSafari(record.opening_hours);
console.log(transfterStrToDate(record.opening_hours),'transfterStrToDate'); console.log(transfterStrToDate(record.opening_hours),'transfterStrToDate');
console.log(arr2,'arr2'); console.log(arr2,'arr2');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment