github.com/MontFerret/ferret@v0.18.0/pkg/stdlib/datetime/now.go (about)

     1  package datetime
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/MontFerret/ferret/pkg/runtime/values"
     7  
     8  	"github.com/MontFerret/ferret/pkg/runtime/core"
     9  )
    10  
    11  // NOW returns new DateTime object with Time equal to time.Now().
    12  // @return {DateTime} - New DateTime object.
    13  func Now(_ context.Context, args ...core.Value) (core.Value, error) {
    14  	err := core.ValidateArgs(args, 0, 0)
    15  	if err != nil {
    16  		return values.None, err
    17  	}
    18  
    19  	return values.NewCurrentDateTime(), nil
    20  }