1
0
mirror of https://github.com/MontFerret/ferret.git synced 2024-12-14 11:23:02 +02:00
ferret/pkg/stdlib/datetime/now.go
2018-10-30 15:59:18 -04:00

21 lines
453 B
Go

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
}