1
0
mirror of https://github.com/golang/go synced 2024-11-22 08:04:39 -07:00

do not crash printing the zero value for time.Time.

R=r
DELTA=2  (1 added, 0 deleted, 1 changed)
OCL=34605
CL=34608
This commit is contained in:
Russ Cox 2009-09-14 16:45:35 -07:00
parent 1a0860b93f
commit c5a441ac70

View File

@ -250,6 +250,7 @@ var shortDayNames = []string{
}
var shortMonthNames = []string{
"---",
"Jan",
"Feb",
"Mar",
@ -301,7 +302,7 @@ func format(t *Time, fmt string) string {
case 'a': // %a abbreviated weekday name
bp = addString(buf, bp, shortDayNames[t.Weekday]);
case 'b': // %b abbreviated month name
bp = addString(buf, bp, shortMonthNames[t.Month-1]);
bp = addString(buf, bp, shortMonthNames[t.Month]);
case 'd': // %d day of month (01-31)
decimal(buf[bp:bp+2], t.Day);
bp += 2;