Query Parameters
Overview
Query parameters allow you to customize the report date range directly through the URL. This method is useful for sharing specific report links or bookmarking pages with predefined time frames.
The available parameters —range
, from
, and to
— give you control over how the date range is set, with options for relative ranges or specific dates.
Here are some practical examples of how you can use range query strings:
- Bookmark a page at a specific range: You can set the Mug page to always open at the “This Month” range.
- Link someone to a specific range: You can share a link to the Energy page to compare energy spent between specific dates.
Available Parameters
The following parameters are optional and can be combined or used separately:
range
defines a specific time range (e.g., “lastweek”).from
sets the start date. If onlyfrom
is specified, the end date defaults to the current date.to
sets the end date. If onlyto
is specified, the start date defaults to the earliest entry in your log.
Range Parameter Composition
The range
parameter is composed of three parts:
1. Relative Indicator
One of the following:
- this: Includes the current partial time unit.
- last: Excludes the current time unit.
2. Numeric Value
A positive integer indicating how many units back in time to go (optional, defaults to 1).
3. Time Unit
Specifies the period to apply, which can be written in singular or plural form:
- minute(s)
- hour(s)
- day(s)
- week(s)
- month(s)
- year(s)
Example Ranges
thismonth
includes the current month.last2months
excludes the current month and includes the last two full months.last7days
excludes today and includes the past 7 full days.
Special Ranges
In addition to custom ranges, the following pre-defined special ranges can be used:
today
includes all entries from the start of the current day.yesterday
includes all entries from the previous day.alltime
includes all entries in the log, from the first entry to the current time.
From & To Parameters
You can set a specific date or time range using the from
and to
parameters, which support two formats.
They don’t both have to be in the same format.
1. Basic ISO 8601
The first is based on the Basic ISO 8601 format, in UTC (TCT), following the pattern YYYYMMDDThhmmssZ
I say “based on” because some partial dates and times disallowed by the standard are accepted for convenience, as long as they match one of the formats below.
These are all the accepted strings for from
and to
:
Format | Description | Example |
---|---|---|
YYYY | Year only | &to=2023 → Jan 1, 2023, 00:00:00 |
YYYYMM | Year and month | &to=202309 → Sep 1, 2023, 00:00:00 |
YYYYMMDD | Year, month, and day | &to=20230925 → Sep 25, 2023, 00:00:00 |
YYYYMMDDT | Same as above with T at the end | &to=20230925T → Sep 25, 2023, 00:00:00 |
YYYYMMDDThh | Year, month, day, and hour | &to=20230925T14 → Sep 25, 2023, 14:00:00 |
YYYYMMDDThhmm | Year, month, day, hour, and minute | &to=20230925T1430 → Sep 25, 2023, 14:30:00 |
YYYYMMDDThhmmss | Year, month, day, hour, minute, and second | &to=20230925T143015 → Sep 25, 2023, 14:30:15 |
YYYYMMDDThhmmssZ | Same as above with Z at the end | &to=20230925T143015Z → Sep 25, 2023, 14:30:15 |
2. Unix Timestamp
You can also use Unix timestamps for from
and to
.
Behavior
Valid Range + From & To
If range
is valid, from
and to
will be overridden by the range.
You do not need to specify from
or to
when using range
, but they will still be displayed and updated to reflect the selected range.
This allows you to fine-tune the date range later by removing the range parameter and modifying from
and to
directly.
Range Invalid or Not Included
If range
is invalid or not present, from
and to
will be used to set the start and end dates if present.
From & To Not In Log Range
- If the
from
date is earlier than the earliest log entry, it will be automatically adjusted to match the first log entry. - If the
to
date is later than the current time, it will be adjusted to the current time.