summary refs log tree commit diff stats
path: root/lib/templates
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-06-26 09:25:53 +0200
committerReto Brunner <reto@labrat.space>2020-06-26 09:25:53 +0200
commit8f1c6c46ff1de2d94377c0cf20fdc8bbdba59fef (patch)
tree5ebbdb98a2f28419c6cdaf193c5dc76ebaea5c45 /lib/templates
parent91db250272502f9d1f1f388fa59f5782fd103815 (diff)
downloadaerc-8f1c6c46ff1de2d94377c0cf20fdc8bbdba59fef.tar.gz
Fix dates in reply/forward commands.
The data was passed around as a string for some reason, which led to time
precision loss and wrong dates being displayed.
Simply pass the time as is to fix that.
Diffstat (limited to 'lib/templates')
-rw-r--r--lib/templates/template.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/templates/template.go b/lib/templates/template.go
index d16ac1f..4346111 100644
--- a/lib/templates/template.go
+++ b/lib/templates/template.go
@@ -46,7 +46,7 @@ func TestTemplateData() TemplateData {
 	}
 
 	original := models.OriginalMail{
-		Date:     time.Now().Format("Mon Jan 2, 2006 at 3:04 PM"),
+		Date:     time.Now(),
 		From:     "John Doe <john@example.com>",
 		Text:     "This is only a test text",
 		MIMEType: "text/plain",
@@ -56,7 +56,6 @@ func TestTemplateData() TemplateData {
 }
 
 func ParseTemplateData(defaults map[string]string, original models.OriginalMail) TemplateData {
-	originalDate, _ := time.Parse("Mon Jan 2, 2006 at 3:04 PM", original.Date)
 	td := TemplateData{
 		To:               parseAddressList(defaults["To"]),
 		Cc:               parseAddressList(defaults["Cc"]),
@@ -66,7 +65,7 @@ func ParseTemplateData(defaults map[string]string, original models.OriginalMail)
 		Subject:          defaults["Subject"],
 		OriginalText:     original.Text,
 		OriginalFrom:     parseAddressList(original.From),
-		OriginalDate:     originalDate,
+		OriginalDate:     original.Date,
 		OriginalMIMEType: original.MIMEType,
 	}
 	return td
f='#n184'>184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290