mirror of
https://github.com/golang/go
synced 2024-11-26 00:07:57 -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:
parent
1a0860b93f
commit
c5a441ac70
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user