add default datetime format, fix default format usage

This commit is contained in:
2025-09-25 20:35:26 +02:00
parent ef4cc8b84b
commit 22d9da642a
3 changed files with 7 additions and 3 deletions

View File

@@ -31,7 +31,7 @@ import (
) )
const ( const (
VERSIONstring = "0.0.3" VERSIONstring = "0.0.4"
Usage string = `This is ts, a timestamp tool. Usage string = `This is ts, a timestamp tool.
Usage: ts <time string> [<time string>] Usage: ts <time string> [<time string>]
@@ -76,8 +76,11 @@ noon Yesterday at 10:15am Mon, 02 Jan 2006 15:
Example durations for second parameter: Example durations for second parameter:
2d1h30m 2 days, one and a half hour 2d1h30m 2 days, one and a half hour
30m 30 minutes` 30m 30 minutes`
ModeDiff int = iota ModeDiff int = iota
ModeAdd ModeAdd
DefaultFormat string = "Mon Jan 02 15:04:05 MST"
) )
type Config struct { type Config struct {

View File

@@ -105,7 +105,8 @@ func (tp *TimestampProccessor) SingleTimestamp(timestamp string) error {
return err return err
} }
tp.Print(ts) tp.Print(TPdatetime{TimestampProccessor: *tp, Data: ts})
//tp.Print(ts)
return nil return nil
} }

View File

@@ -87,7 +87,7 @@ func (datetime TPdatetime) String() string {
case "datetime": case "datetime":
fallthrough fallthrough
case "": case "":
return datetime.Data.String() return datetime.Data.Format(DefaultFormat)
default: default:
return datetime.Data.Format(datetime.Format) return datetime.Data.Format(datetime.Format)
} }