Skip to content

Commit

Permalink
feat: add low skies interval
Browse files Browse the repository at this point in the history
  • Loading branch information
taciturnaxolotl committed Oct 16, 2024
1 parent 87feddd commit f325c85
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions helpers/interval.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ func ResolveIntervalTZ(interval *models.IntervalKey, tz *time.Location) (err err
from = now.AddDate(0, -12, 0)
case models.IntervalAny:
from = time.Time{}
case models.IntervalLowSkies:
from = time.Date(2024, 10, 3, 0, 0, 0, 0, time.Local)
to = time.Date(2024, 10, 17, 23, 59, 59, 0, time.Local)
default:
err = errors.New("invalid interval")
}
Expand Down
2 changes: 2 additions & 0 deletions models/interval.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var (
IntervalPast6Months = &IntervalKey{"6_months", "last_6_months", "Last 6 Months"}
IntervalPast12Months = &IntervalKey{"12_months", "last_12_months", "last_year", "Last 12 Months"}
IntervalAny = &IntervalKey{"any", "all_time", "All Time"}
IntervalLowSkies = &IntervalKey{"low_skies", "Low Skies"}
)

var AllIntervals = []*IntervalKey{
Expand All @@ -40,6 +41,7 @@ var AllIntervals = []*IntervalKey{
IntervalPast6Months,
IntervalPast12Months,
IntervalAny,
IntervalLowSkies,
}

type IntervalKey []string
Expand Down
8 changes: 8 additions & 0 deletions views/time-picker.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
<div
class="grow flex flex-col bg-accent-primary dark:bg-accent-dark-primary shadow-md rounded w-40 p-1"
>
<a
id="time-option-low_skies"
class="submenu-item hover:bg-accent-secondary hover:dark:bg-accent-dark-secondary rounded p-1 text-right w-full text-gray-300 px-2 font-semibold text-sm"
:href="intervalLink('low_skies')"
@click="state.showDropdownTimepicker = !state.showDropdownTimepicker"
data-trigger-for="showDropdownTimepicker"
>Low Skies</a
>
<a
id="time-option-today"
class="submenu-item hover:bg-accent-secondary hover:dark:bg-accent-dark-secondary rounded p-1 text-right w-full text-gray-300 px-2 font-semibold text-sm"
Expand Down

0 comments on commit f325c85

Please sign in to comment.