You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: api/pkg/validators/bulk_message_handler_validator.go
+21-7Lines changed: 21 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -138,14 +138,15 @@ func (v *BulkMessageHandlerValidator) parseXlsx(ctxLogger telemetry.Logger, user
138
138
continue
139
139
}
140
140
141
-
varsendAt*time.Time
141
+
varsendTimeRawstring
142
142
iflen(row) >3&&strings.TrimSpace(row[3]) !="" {
143
143
ctxLogger.Info(fmt.Sprintf("excel time = [%s]", row[3]))
144
-
sendAt, err=v.convertExcelTime(user, row[3])
144
+
sendAt, err:=v.convertExcelTime(user, row[3])
145
145
iferr!=nil {
146
146
result.Add("document", fmt.Sprintf("Row [%d]: The SendTime [%s] is not in the correct format e.g [2006-01-02T15:04:05] where 2006 is the year, 01 is January, 02 is the second day of the month and the time is 15:04:05", index+1, row[3]))
147
147
returnnil, result
148
148
}
149
+
sendTimeRaw=sendAt.Format(time.RFC3339)
149
150
}
150
151
151
152
varattachmentURLsstring
@@ -157,7 +158,7 @@ func (v *BulkMessageHandlerValidator) parseXlsx(ctxLogger telemetry.Logger, user
157
158
FromPhoneNumber: strings.TrimSpace(row[0]),
158
159
ToPhoneNumber: strings.TrimSpace(row[1]),
159
160
Content: row[2],
160
-
SendTime: sendAt,
161
+
SendTimeRaw: sendTimeRaw,
161
162
AttachmentURLs: attachmentURLs,
162
163
})
163
164
}
@@ -253,20 +254,33 @@ func (v *BulkMessageHandlerValidator) validateMessages(_ context.Context, messag
result.Add("document", fmt.Sprintf("Row [%d]: The SendTime [%s] cannot be more than 20 days (420 hours) in the future.", index+2, message.SendTime.Format(time.RFC3339)))
277
+
ifstrings.TrimSpace(message.SendTimeRaw) !="" {
278
+
sendTime:=message.GetSendTime()
279
+
ifsendTime==nil {
280
+
result.Add("document", fmt.Sprintf("Row [%d]: The SendTime [%s] is not a valid date format. Use RFC3339 (e.g. 2023-11-11T02:10:01Z) or YYYY-MM-DDTHH:MM:SS.", index+2, message.SendTimeRaw))
result.Add("document", fmt.Sprintf("Row [%d]: The SendTime [%s] cannot be more than 20 days (420 hours) in the future.", index+2, sendTime.Format(time.RFC3339)))
0 commit comments