shithub: mc

Download patch

ref: 35a72b699a732f3a331df2595970eb7b532f457d
parent: 7cee6c2a0554637015c60ccfaac91d783655b20e
author: Ori Bernstein <[email protected]>
date: Fri Nov 6 18:21:12 EST 2015

Fix some date formatting functions.

--- a/lib/date/fmt.myr
+++ b/lib/date/fmt.myr
@@ -48,12 +48,12 @@
 			| 'A':	std.sbfmt(sb, "{}", _names.fullday[d.day])
 			| 'b':	std.sbfmt(sb, "{}", _names.abbrevmon[d.mon])
 			| 'B':	std.sbfmt(sb, "{}", _names.fullmon[d.mon])
-			| 'c':	datefmt(sb, "%Y-%m-%d", d)
+			| 'c':	datefmt(sb, "%Y-%m-%d %H:%M:%S %z", d)
 			| 'C':	std.sbfmt(sb, "{p=0,w=2}", d.year % 100)
 			| 'd':	std.sbfmt(sb, "{p=0,w=2}", d.day)
 			| 'D':	datefmt(sb, "%m/%d/%y (wtf america)", d)
 			| 'e':	std.sbfmt(sb, "{w=2}", d.day)
-			| 'F':	datefmt(sb, "%y-%m-%d", d)
+			| 'F':	datefmt(sb, "%Y-%m-%d", d)
 			/*
 			| 'G':	s = std.sbfmt(sb, ...?
 			| 'g':
@@ -70,10 +70,11 @@
 			| 'O':	std.sbfmt(sb, "unsupported %O")
 			| 'p':	std.sbfmt(sb, "{}", ["AM", "PM"][d.h/12])
 			| 'P':	std.sbfmt(sb, "{}", ["am", "pm"][d.h/12])
-			| 'r':	datefmt(sb, "%H:%M:%S %P", d) 
-			| 'R':	datefmt(sb, "%H:%M %P", d)
-			| 's':	std.sbfmt(sb, "{}", d.actual)
+			| 'r':	datefmt(sb, "%I:%M:%S %P", d) 
+			| 'R':	datefmt(sb, "%H:%M", d)
+			| 's':	std.sbfmt(sb, "{}", d.actual / 1_000_000)
 			| 'S':	std.sbfmt(sb, "{p=0,w=2}", d.s)
+			| 'T':	datefmt(sb, "%H:%M:%S", d)
 			| 't':	std.sbfmt(sb, "\t")
 			| 'u':	std.sbfmt(sb, "{}", d.wday)
 			| 'U':	std.sbfmt(sb, "week number... unimplemented.")