aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Donnet2018-01-30 16:39:34 +0100
committerGitHub2018-01-30 16:39:34 +0100
commit37d26847449315799b2e526d02eb361eb41610bc (patch)
treed9b7fa98ffa9e8cbf502c7ae01381f8acc739819
parentf3109bb9687f66119a7778a44fe95b73c632ffe7 (diff)
parent1a7365643b808617445e3a8051d13dcee3a820a4 (diff)
downloadchouette-core-37d26847449315799b2e526d02eb361eb41610bc.tar.bz2
Merge pull request #259 from af83/5717-fix-periods-on-timetables
5717 Fix TZ related issues
-rw-r--r--app/javascript/time_tables/actions/index.js8
-rw-r--r--app/javascript/time_tables/components/Navigate.js6
2 files changed, 7 insertions, 7 deletions
diff --git a/app/javascript/time_tables/actions/index.js b/app/javascript/time_tables/actions/index.js
index 13cb96b64..87c7a3e8d 100644
--- a/app/javascript/time_tables/actions/index.js
+++ b/app/javascript/time_tables/actions/index.js
@@ -157,7 +157,7 @@ const actions = {
monthName(strDate) {
let monthList = range(1,13).map(n => I18n.calendars.months[n])
let date = new Date(strDate)
- return monthList[date.getMonth()]
+ return monthList[date.getUTCMonth()]
},
getHumanDate(strDate, mLimit) {
let origin = strDate.split('-')
@@ -173,7 +173,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 +194,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 +325,4 @@ const actions = {
}
}
-export default actions \ No newline at end of file
+export default actions
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()) : ''}
<span className='caret'></span>
</div>
<ul
@@ -41,7 +41,7 @@ export default function Navigate({ dispatch, metas, timetable, pagination, statu
dispatch(actions.checkConfirmModal(e, actions.changePage(dispatch, e.currentTarget.value), pagination.stateChanged, dispatch, metas, timetable))
}}
>
- {actions.monthName(month) + ' ' + new Date(month).getFullYear()}
+ {actions.monthName(month) + ' ' + new Date(month).getUTCFullYear()}
</button>
</li>
))}
@@ -86,4 +86,4 @@ Navigate.propTypes = {
status: PropTypes.object.isRequired,
pagination: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired
-} \ No newline at end of file
+}