refactor(config): rename the period helper to frPeriod

The helper renders French period labels (Janvier 2026, T2 2026, S1 2026),
so it carries the fr prefix like frDate. Config example, arch.md and
user-stories.md updated. Configs calling period(...) must switch to
frPeriod(...).
This commit is contained in:
2026-11-04 22:00:36 +01:00
parent f8734f79ca
commit 6961256538
4 changed files with 12 additions and 12 deletions
+6 -6
View File
@@ -189,7 +189,7 @@ func CompileExpr(src string) (*vm.Program, error) {
func exprOptions() []expr.Option {
return []expr.Option{
expr.Function("firstMatch", FirstMatch),
expr.Function("period", Period),
expr.Function("frPeriod", FrPeriod),
expr.Function("frDate", FrenchDate),
}
}
@@ -472,14 +472,14 @@ func FrenchDate(args ...any) (any, error) {
var frenchMonths = []string{"Janvier", "Février", "Mars", "Avril", "Mai", "Juin",
"Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"}
// Period is the period(value, unit, shift, layout?) helper (arch.md §5).
func Period(args ...any) (any, error) {
// FrPeriod is the frPeriod(value, unit, shift, layout?) helper (arch.md §5).
func FrPeriod(args ...any) (any, error) {
if len(args) < 3 {
return "", fmt.Errorf("period: value, unit and shift required")
return "", fmt.Errorf("frPeriod: value, unit and shift required")
}
d, ok := args[0].(time.Time)
if !ok {
return "", fmt.Errorf("period: value must be a native date")
return "", fmt.Errorf("frPeriod: value must be a native date")
}
unit, _ := args[1].(string)
shift, _ := toInt(args[2])
@@ -533,7 +533,7 @@ func Period(args ...any) (any, error) {
}
return time.Date(y, 1, 1, 0, 0, 0, 0, time.UTC).Format(layout), nil
default:
return "", fmt.Errorf("period: unknown unit %q (want month|quarter|half|year)", unit)
return "", fmt.Errorf("frPeriod: unknown unit %q (want month|quarter|half|year)", unit)
}
}