period

package
v0.1.708 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	contract.PeriodOperator
}

func NewClient

func NewClient(opts ClientOptions) Client

type ClientOption added in v0.1.6

type ClientOption func(*ClientOptions)

func WithOffset

func WithOffset(x int) ClientOption

type ClientOptions added in v0.1.6

type ClientOptions struct {
	Offset int
}

func ApplyClientOptions added in v0.1.6

func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions

type DefaultTool added in v0.1.11

type DefaultTool struct {
	T *contract.Tool[Client]
}

func NewTool

func NewTool(c Client, opts contract.ToolOptions[Client]) *DefaultTool

func (*DefaultTool) CloneWithOffset added in v0.1.631

func (d *DefaultTool) CloneWithOffset(ctx context.Context, x int) (contract.PeriodOperator, error)

CloneWithOffset creates a new clone with the specified offset.

func (*DefaultTool) FirstDayOfMonth added in v0.1.11

func (d *DefaultTool) FirstDayOfMonth(ctx context.Context, date *contract.Dt) (*contract.Dt, error)

FirstDayOfMonth retrieves the first day of the month for the given Dt.

func (*DefaultTool) FirstPeriodStartDate added in v0.1.11

func (d *DefaultTool) FirstPeriodStartDate(ctx context.Context, year int) (*contract.Dt, error)

FirstPeriodStartDate retrieves the date of the first day of the first period of the given year. INFO: The first day of the first period is the Sunday immediately before the first Monday of the year (Offset = 0).

func (*DefaultTool) LastDayOfLastPeriod added in v0.1.11

func (d *DefaultTool) LastDayOfLastPeriod(ctx context.Context, year int) (*contract.Dt, error)

LastDayOfLastPeriod retrieves the last day of the last period of the given year.

func (*DefaultTool) PeriodBounds added in v0.1.635

func (d *DefaultTool) PeriodBounds(ctx context.Context, date *contract.Dt) (*contract.Dt, *contract.Dt, error)

PeriodBounds returns UTC [start, end] (inclusive) of the 7-day period containing date.

func (*DefaultTool) PeriodNumber added in v0.1.11

func (d *DefaultTool) PeriodNumber(ctx context.Context, date *contract.Dt) (int, error)

PeriodNumber retrieves the period week number for the given Dt.

func (*DefaultTool) TimeOfPeriodWeekday added in v0.1.636

func (d *DefaultTool) TimeOfPeriodWeekday(ctx context.Context, date *contract.Dt, weekday time.Weekday) (*contract.Dt, error)

TimeOfPeriodWeekday returns the Dt of weekday within the payroll period week that contains date.

type Tool added in v0.1.245

type Tool interface {
	Client
}

Jump to

Keyboard shortcuts

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