From b72fba2b5400e7e67b7accb23ca4cf57619279f6 Mon Sep 17 00:00:00 2001 From: esp Date: Mon, 31 Aug 2015 08:27:46 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=E5=90=8E=E5=8F=B0=E6=AF=94?= =?UTF-8?q?=E8=B5=9B=E7=AE=A1=E7=90=86=E7=BC=96=E8=BE=91,=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E4=BC=A0=E6=9D=A5=E7=9A=84=E6=98=AFutc=E6=97=B6?= =?UTF-8?q?=E9=97=B4,=E5=9B=A0=E4=B8=BA=E5=BC=80=E5=A7=8B,=E7=BB=93?= =?UTF-8?q?=E6=9D=9F=E6=97=B6=E9=97=B4=E8=B7=9F=E5=88=9B=E5=BB=BA,?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4=E7=9A=84=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E6=98=AF=E4=B8=8D=E5=90=8C=E7=9A=84,?= =?UTF-8?q?=E6=88=91=E9=80=9A=E8=BF=87=E4=BF=AE=E6=94=B9=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=A7=A3=E5=86=B3=E4=BA=86=E8=AF=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98.=E4=BD=86=E6=98=AF=E6=AF=94=E8=BE=83=E7=B9=81?= =?UTF-8?q?=E7=90=90,=E5=9B=A0=E4=B8=BA=E5=9C=A8=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E8=BF=99=E4=B8=AA=E6=97=A5=E6=9C=9F=E4=BD=BF=E7=94=A8=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2=E6=9D=A5=E5=AD=98=E5=82=A8=E7=9A=84.?= =?UTF-8?q?=E8=80=8C=E5=90=8E=E7=AB=AF=E8=99=BD=E6=98=AFdatetime=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B,=E4=BD=86=E8=BF=94=E5=9B=9E=E7=9A=84=E6=98=AF?= =?UTF-8?q?=E6=AF=94=E8=B5=9B=E7=9A=84=E6=95=B0=E7=BB=84,=E8=8B=A5?= =?UTF-8?q?=E8=A6=81=E5=A4=84=E7=90=86=E4=B9=9F=E8=BE=83=E7=B9=81=E7=90=90?= =?UTF-8?q?,=E4=B8=94=E6=9A=82=E6=B2=A1=E6=89=BE=E5=88=B0=E7=AE=80?= =?UTF-8?q?=E6=B4=81=E7=9A=84=E5=86=99=E6=B3=95.=E4=BA=8E=E6=98=AF?= =?UTF-8?q?=E8=BF=98=E6=98=AF=E9=80=89=E6=8B=A9=E4=BA=86=E6=94=B9=E5=89=8D?= =?UTF-8?q?=E7=AB=AF,=E5=85=B6=E5=AE=9E=E5=AE=9E=E8=B4=A8=E4=B8=8A?= =?UTF-8?q?=E6=98=AF=E6=89=8B=E5=B7=A5=E7=BB=99=E6=97=B6=E9=97=B4=E5=8A=A0?= =?UTF-8?q?=E4=BA=868=E5=B0=8F=E6=97=B6.....[CI=20SKIP]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/js/app/admin/contest/contestList.js | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/static/src/js/app/admin/contest/contestList.js b/static/src/js/app/admin/contest/contestList.js index f63cdccd..4135fceb 100644 --- a/static/src/js/app/admin/contest/contestList.js +++ b/static/src/js/app/admin/contest/contestList.js @@ -149,8 +149,16 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker", vm.editingContestId = contestId; vm.editTitle = vm.contestList[contestId-1].title; vm.editPassword = vm.contestList[contestId-1].password; - vm.editStartTime = vm.contestList[contestId-1].start_time.substring(0,16).replace("T"," "); - vm.editEndTime = vm.contestList[contestId-1].end_time.substring(0,16).replace("T"," "); + //var startTime = new Date(), endTime = new Date(); + //startTime.setFullYear(parseInt(vm.contestList[contestId-1].start_time.substring(0,4))) + //startTime.setMonth(parseInt(vm.contestList[contestId-1].start_time.substring(5,7))) + //startTime.setDate(parseInt(vm.contestList[contestId-1].start_time.substring(8,10))) + //startTime.setHours(parseInt(vm.contestList[contestId-1].start_time.substring(11,13))) + //startTime.setMinutes(parseInt(vm.contestList[contestId-1].start_time.substring(14,16))) + //startTime = new Date(startTime + 8 * 60 * 60 * 1000) + + vm.editStartTime = add8Hours(vm.contestList[contestId-1].start_time); + vm.editEndTime = add8Hours(vm.contestList[contestId-1].end_time);//.substring(0,16).replace("T"," "); vm.editMode = vm.contestList[contestId-1].mode; vm.editVisible = vm.contestList[contestId-1].visible; if (vm.contestList[contestId-1].contest_type == 0) { //contest type == 0, contest in group @@ -291,6 +299,40 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "datetimePicker", } }); } + + function add8Hours(UtcString) { + console.log(UtcString); + var M = [31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + /*time.setFullYear(parseInt(UtcString.substring(0,4))) + time.setMonth(parseInt(UtcString.substring(5,7))) + time.setDate(parseInt(UtcString.substring(8,10))) + time.setHours(parseInt(UtcString.substring(11,13))) + time.setMinutes(parseInt(UtcString.substring(14,16))) + time = new Date(time + 8 * 60 * 60 * 1000)*/ + var year =UtcString.substring(0,4); + var month =UtcString.substring(5,7); + var day =UtcString.substring(8,10); + var hour =parseInt(UtcString.substring(11,13)) + 8; + var minute = UtcString.substring(14,16); + if (hour > 23) { + hour -= 24; day = parseInt(day)+1; month = parseInt(month); + if (month == 2) if (!(year%400)||(!(year%4)&&year%100)) M[2] = 29; + if (day > M[month]) { + day = 1; + month = parseInt(month)+1; + if (month > 12) { + year=parseInt(year)+1; month = 1; + } + } + month = month.toString(); + day = day.toString(); + if (month.length==1) month = "0"+month; + if (day.length==1) day = "0"+day; + } + hour = hour.toString(); + if (hour.length==1) hour="0"+hour; + return year+"-"+month+"-"+day+" "+hour+":"+minute; + } // Get group list $.ajax({ // Get current user type url: "/api/user/",