timeutils

package
v0.0.0-...-6307f30 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateDateRange

func CalculateDateRange(baseDay time.Time, duration int) (startDate, endDate string)

CalculateDateRange generates a string representation of the start and end dates, starting from `baseDay` and lasting for `duration` days.

func CalculateWeekendRange

func CalculateWeekendRange(weekOffset int) (departureStartDate, departureEndDate, arrivalStartDate, arrivalEndDate string)

CalculateWeekendRange calculates the date range for the specified weekend based on the current date and the `weekOffset` indicating which weekend to calculate. 0 = this weekend, 1 = next weekend, etc.

func DetermineRangeBasedOnCurrentDay

func DetermineRangeBasedOnCurrentDay(currentDay time.Weekday) (time.Weekday, time.Weekday)

determineRangeBasedOnCurrentDay calculates the range of days to consider based on the current day

func GetDaysOrder

func GetDaysOrder() ([]time.Weekday, time.Weekday, time.Weekday)

GetDaysOrder returns the order of days for the week based on the current day, along with startDay and endDay.

func GetNextWeekday

func GetNextWeekday(baseDay time.Time, weekday time.Weekday, includeCurrent bool) time.Time

GetNextWeekday finds the next occurrence of a specific weekday from a given day. If `includeCurrent` is true and `baseDay` is the same as `weekday`, `baseDay` will be returned.

func ListDatesBetween

func ListDatesBetween(start, end string) ([]string, error)

ListDatesBetween generates a list of dates in the format "YYYY-MM-DD" between two given dates, inclusive.

func ShouldIncludeDay

func ShouldIncludeDay(day, startDay, endDay time.Weekday) bool

shouldIncludeDay checks if a day is within the specified range

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL