adding new formatters
This commit is contained in:
parent
61b8b7a785
commit
e7c2568a69
2 changed files with 11 additions and 2 deletions
|
|
@ -13,6 +13,11 @@ func TimeValueFormatter(v interface{}) string {
|
|||
return TimeValueFormatterWithFormat(v, DefaultDateFormat)
|
||||
}
|
||||
|
||||
// TimeHourValueFormatter is a ValueFormatter for timestamps.
|
||||
func TimeHourValueFormatter(v interface{}) string {
|
||||
return TimeValueFormatterWithFormat(v, DefaultDateHourFormat)
|
||||
}
|
||||
|
||||
// TimeValueFormatterWithFormat is a ValueFormatter for timestamps with a given format.
|
||||
func TimeValueFormatterWithFormat(v interface{}, dateFormat string) string {
|
||||
if typed, isTyped := v.(time.Time); isTyped {
|
||||
|
|
@ -29,7 +34,7 @@ func TimeValueFormatterWithFormat(v interface{}, dateFormat string) string {
|
|||
|
||||
// FloatValueFormatter is a ValueFormatter for float64.
|
||||
func FloatValueFormatter(v interface{}) string {
|
||||
return FloatValueFormatterWithFormat(v, "%.2f")
|
||||
return FloatValueFormatterWithFormat(v, DefaultFloatFormat)
|
||||
}
|
||||
|
||||
// FloatValueFormatterWithFormat is a ValueFormatter for float64 with a given format.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue