1
0
mirror of https://github.com/MontFerret/ferret.git synced 2024-12-21 01:21:34 +02:00
ferret/pkg/stdlib/datetime/now.go

21 lines
453 B
Go
Raw Normal View History

2018-10-30 21:59:18 +02:00
package datetime
import (
"context"
"github.com/MontFerret/ferret/pkg/runtime/values"
"github.com/MontFerret/ferret/pkg/runtime/core"
)
// Now returns new DateTime object with Time equal to time.Now().
// @returns (DateTime) - New DateTime object.
func Now(_ context.Context, args ...core.Value) (core.Value, error) {
err := core.ValidateArgs(args, 0, 0)
if err != nil {
return values.None, err
}
return values.NewCurrentDateTime(), nil
}