mirror of
https://github.com/plausible/analytics.git
synced 2024-11-26 23:27:54 +03:00
parent
4cbebe8ac9
commit
3e33385afd
@ -7,8 +7,12 @@ export function formatISO(date) {
|
||||
|
||||
export function shiftMonths(date, months) {
|
||||
const newDate = new Date(date.getTime())
|
||||
newDate.setMonth(newDate.getMonth() + months)
|
||||
return newDate
|
||||
const d = newDate.getDate();
|
||||
newDate.setMonth(newDate.getMonth() + +months);
|
||||
if (newDate.getDate() != d) {
|
||||
newDate.setDate(0);
|
||||
}
|
||||
return newDate;
|
||||
}
|
||||
|
||||
export function shiftDays(date, days) {
|
||||
|
@ -294,7 +294,7 @@ class DatePicker extends React.Component {
|
||||
boldClass = query.period === period ? "font-bold" : "";
|
||||
}
|
||||
|
||||
const date = opts.date ? formatISO(opts.date) : false;
|
||||
opts.date = opts.date ? formatISO(opts.date) : false;
|
||||
|
||||
const keybinds = {
|
||||
'Today': 'D',
|
||||
@ -308,7 +308,7 @@ class DatePicker extends React.Component {
|
||||
|
||||
return (
|
||||
<QueryLink
|
||||
to={{from: false, to: false, date, period, ...opts}}
|
||||
to={{from: false, to: false, period, ...opts}}
|
||||
onClick={this.close.bind(this)}
|
||||
query={this.props.query}
|
||||
className={`${boldClass } px-4 py-2 md:text-sm leading-tight hover:bg-gray-100
|
||||
|
@ -79,8 +79,8 @@ export function navigateToQuery(history, queryFrom, newData) {
|
||||
}
|
||||
|
||||
class QueryLink extends React.Component {
|
||||
constructor() {
|
||||
super()
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.onClick = this.onClick.bind(this)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user