Skip to content

Commit

Permalink
[core] use RFC3339 dates format
Browse files Browse the repository at this point in the history
  • Loading branch information
capcom6 committed Oct 29, 2024
1 parent 417036f commit 7bc0e64
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Options:
- `--phones value, -p value, --phone value`: Phone numbers (can be specified multiple times or comma-separated)
- `--sim value`: SIM card index (1-3) (default: 0)
- `--ttl value`: Time to live as duration string like "1h30m" (default: unlimited)
- `--validUntil value`: Valid until (format: YYYY-MM-DD HH:MM:SS in local timezone)
- `--validUntil value`: Valid until (format: YYYY-MM-DDTHH:MM:SS+00:00)

#### Get Message Status

Expand Down
2 changes: 1 addition & 1 deletion internal/commands/messages/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var send = &cli.Command{
&cli.TimestampFlag{
Name: "validUntil",
Usage: "Valid until",
Layout: time.DateTime,
Layout: time.RFC3339,
Timezone: time.Local,
},
},
Expand Down
32 changes: 16 additions & 16 deletions internal/core/output/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}

0 comments on commit 7bc0e64

Please sign in to comment.