Fix date display

This commit is contained in:
Uku Taht 2022-04-05 10:27:09 +03:00
parent 4f45bb0480
commit fb60032a75
2 changed files with 2 additions and 4 deletions

View File

@ -184,8 +184,6 @@ class DatePicker extends React.Component {
const redirects = [{date: false, period: 'day'}, {date: shiftDays(nowForSite(this.props.site), -1), period: 'day'}, {period: 'realtime'}, {date: false, period: '7d'}, {date: false, period: 'month'}, {date: false, period: 'year'}, {date: false, period: '30d'}, {date: false, period: '6mo'}, {date: false, period: '12mo'}, {date: false, period: 'all'}];
if (keys.includes(e.key.toLowerCase())) {
console.log(e.key.toLowerCase())
console.log(redirects[keys.indexOf(e.key.toLowerCase())])
navigateToQuery(history, query, {...newSearch, ...(redirects[keys.indexOf(e.key.toLowerCase())])});
} else if (e.key.toLowerCase() === 'c') {
this.setState({mode: 'calendar', open: true}, this.openCalendar);

View File

@ -51,11 +51,11 @@ function buildDataSet(plot, present_index, ctx, label) {
}
}
import {formatMonthYYYY, formatDay} from '../util/date'
import {parseUTCDate, formatMonthYYYY, formatDay} from '../util/date'
function dateFormatter(interval, longForm) {
return function(isoDate, _index, _ticks) {
let date = new Date(isoDate)
let date = parseUTCDate(isoDate)
if (interval === 'month') {
return formatMonthYYYY(date)