...

Source file src/github.com/noirbizarre/gonja/ext/time/config.go

Documentation: github.com/noirbizarre/gonja/ext/time

     1  package time
     2  
     3  import (
     4  	arrow "github.com/bmuller/arrow/lib"
     5  
     6  	"github.com/noirbizarre/gonja/config"
     7  )
     8  
     9  type Config struct {
    10  	// Default format
    11  	DatetimeFormat string
    12  	// If defined, now returns this parsed value
    13  	Now *arrow.Arrow
    14  }
    15  
    16  func NewConfig() *Config {
    17  	return &Config{
    18  		DatetimeFormat: "%Y-%m-%d",
    19  		Now:            nil,
    20  	}
    21  }
    22  
    23  func (cfg *Config) Inherit() config.Inheritable {
    24  	return &Config{
    25  		DatetimeFormat: cfg.DatetimeFormat,
    26  		Now:            cfg.Now,
    27  	}
    28  }
    29  
    30  // DefaultConfig is a configuration with default values
    31  var DefaultConfig = NewConfig()
    32  

View as plain text