From c71b93d8e7a93300880e5fcbb5c8646ba240e0c1 Mon Sep 17 00:00:00 2001 From: Aleksandr Soloshenko Date: Tue, 29 Oct 2024 14:34:48 +0700 Subject: [PATCH] [core] use RFC3339 dates format --- internal/commands/messages/send.go | 2 +- internal/core/output/text.go | 32 +++++++++++++++--------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/internal/commands/messages/send.go b/internal/commands/messages/send.go index 7565b15..41db07c 100644 --- a/internal/commands/messages/send.go +++ b/internal/commands/messages/send.go @@ -40,7 +40,7 @@ var send = &cli.Command{ &cli.TimestampFlag{ Name: "validUntil", Usage: "Valid until", - Layout: time.DateTime, + Layout: time.RFC3339, Timezone: time.Local, }, }, diff --git a/internal/core/output/text.go b/internal/core/output/text.go index b693bfe..204ed76 100644 --- a/internal/core/output/text.go +++ b/internal/core/output/text.go @@ -33,22 +33,6 @@ func (*TextOutput) MessageState(src smsgateway.MessageState) (string, error) { builder.WriteString("\nIsEncrypted: ") builder.WriteString(boolToString(src.IsEncrypted)) - if len(src.States) > 0 { - builder.WriteString("\nStates: ") - - for _, k := range messageStates { - v, ok := src.States[k] - if !ok { - continue - } - - builder.WriteString("\n\t") - builder.WriteString(k) - builder.WriteString("\t") - builder.WriteString(v.Local().Format(time.DateTime)) - } - } - builder.WriteString("\nRecipients: ") for _, r := range src.Recipients { @@ -64,5 +48,21 @@ func (*TextOutput) MessageState(src smsgateway.MessageState) (string, error) { } } + if len(src.States) > 0 { + builder.WriteString("\nStates: ") + + for _, k := range messageStates { + v, ok := src.States[k] + if !ok { + continue + } + + builder.WriteString("\n\t") + builder.WriteString(k) + builder.WriteString("\t") + builder.WriteString(v.Local().Format(time.RFC3339)) + } + } + return builder.String(), nil }