From 257f1bf2b02001605f8b7ec7e6fd894efad79f47 Mon Sep 17 00:00:00 2001 From: Zog Date: Thu, 25 Jan 2018 05:21:17 -0800 Subject: Refs #5717; Fix TZ related issues --- app/javascript/time_tables/actions/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'app/javascript') diff --git a/app/javascript/time_tables/actions/index.js b/app/javascript/time_tables/actions/index.js index 13cb96b64..787cee439 100644 --- a/app/javascript/time_tables/actions/index.js +++ b/app/javascript/time_tables/actions/index.js @@ -156,8 +156,9 @@ const actions = { }), monthName(strDate) { let monthList = range(1,13).map(n => I18n.calendars.months[n]) + console.log("strDate: "+strDate) let date = new Date(strDate) - return monthList[date.getMonth()] + return monthList[date.getUTCMonth()] }, getHumanDate(strDate, mLimit) { let origin = strDate.split('-') @@ -173,7 +174,7 @@ const actions = { }, getLocaleDate(strDate) { let date = new Date(strDate) - return date.toLocaleDateString() + return date.toLocaleDateString(undefined, { timeZone: 'UTC' }) }, updateSynthesis: ({current_month, time_table_dates: dates, time_table_periods: periods}) => { let newPeriods = reject(periods, 'deleted') @@ -194,7 +195,7 @@ const actions = { for (let period of periods) { let begin = new Date(period.period_start) - let end = new Date(period.period_end) + let end = new Date(period.period_end) if (date >= begin && date <= end) return true } @@ -325,4 +326,4 @@ const actions = { } } -export default actions \ No newline at end of file +export default actions -- cgit v1.2.3 From 1a7365643b808617445e3a8051d13dcee3a820a4 Mon Sep 17 00:00:00 2001 From: Zog Date: Thu, 25 Jan 2018 22:10:07 -1000 Subject: Refs #5717; Fix month selection --- app/javascript/time_tables/actions/index.js | 1 - app/javascript/time_tables/components/Navigate.js | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'app/javascript') diff --git a/app/javascript/time_tables/actions/index.js b/app/javascript/time_tables/actions/index.js index 787cee439..87c7a3e8d 100644 --- a/app/javascript/time_tables/actions/index.js +++ b/app/javascript/time_tables/actions/index.js @@ -156,7 +156,6 @@ const actions = { }), monthName(strDate) { let monthList = range(1,13).map(n => I18n.calendars.months[n]) - console.log("strDate: "+strDate) let date = new Date(strDate) return monthList[date.getUTCMonth()] }, diff --git a/app/javascript/time_tables/components/Navigate.js b/app/javascript/time_tables/components/Navigate.js index 64f05cb41..1467fffe9 100644 --- a/app/javascript/time_tables/components/Navigate.js +++ b/app/javascript/time_tables/components/Navigate.js @@ -24,7 +24,7 @@ export default function Navigate({ dispatch, metas, timetable, pagination, statu aria-haspopup='true' aria-expanded='true' > - {pagination.currentPage ? (actions.monthName(pagination.currentPage) + ' ' + new Date(pagination.currentPage).getFullYear()) : ''} + {pagination.currentPage ? (actions.monthName(pagination.currentPage) + ' ' + new Date(pagination.currentPage).getUTCFullYear()) : ''}