mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-24 22:39:22 +01:00
Bumps [github.com/dromara/carbon/v2](https://github.com/dromara/carbon) from 2.5.2 to 2.6.8. - [Release notes](https://github.com/dromara/carbon/releases) - [Commits](https://github.com/dromara/carbon/compare/v2.5.2...v2.6.8) --- updated-dependencies: - dependency-name: github.com/dromara/carbon/v2 dependency-version: 2.6.8 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
59 lines
1.1 KiB
Go
59 lines
1.1 KiB
Go
package carbon
|
|
|
|
var (
|
|
// DefaultLayout default layout
|
|
DefaultLayout = DateTimeLayout
|
|
|
|
// DefaultTimezone default timezone
|
|
DefaultTimezone = UTC
|
|
|
|
// DefaultLocale default language locale
|
|
DefaultLocale = "en"
|
|
|
|
// DefaultWeekStartsAt default start date of the week
|
|
DefaultWeekStartsAt = Monday
|
|
|
|
// DefaultWeekendDays default weekend days of the week
|
|
DefaultWeekendDays = []Weekday{
|
|
Saturday, Sunday,
|
|
}
|
|
)
|
|
|
|
type Default struct {
|
|
Layout string
|
|
Timezone string
|
|
Locale string
|
|
WeekStartsAt Weekday
|
|
WeekendDays []Weekday
|
|
}
|
|
|
|
// SetDefault sets default.
|
|
func SetDefault(d Default) {
|
|
if d.Layout != "" {
|
|
DefaultLayout = d.Layout
|
|
}
|
|
if d.Timezone != "" {
|
|
DefaultTimezone = d.Timezone
|
|
}
|
|
if d.Locale != "" {
|
|
DefaultLocale = d.Locale
|
|
}
|
|
if d.WeekStartsAt.String() != "" {
|
|
DefaultWeekStartsAt = d.WeekStartsAt
|
|
}
|
|
if len(d.WeekendDays) > 0 {
|
|
DefaultWeekendDays = d.WeekendDays
|
|
}
|
|
}
|
|
|
|
// ResetDefault resets default.
|
|
func ResetDefault() {
|
|
DefaultLayout = DateTimeLayout
|
|
DefaultTimezone = UTC
|
|
DefaultLocale = "en"
|
|
DefaultWeekStartsAt = Monday
|
|
DefaultWeekendDays = []Weekday{
|
|
Saturday, Sunday,
|
|
}
|
|
}
|