Emit prevmonthyear and nextmonthyear items in -ppp format.

This commit is contained in:
Dianne Skoll
2020-01-18 14:52:17 -05:00
parent 32601da748
commit 828a0d6589
3 changed files with 11 additions and 1 deletions

View File

@@ -616,12 +616,20 @@ The name of the previous month.
.B daysinprevmonth \fIn\fR
The number of days in the previous month.
.TP
.B prevmonthyear \fIyyyy\fR
The year of the previous month. (The same as \fByear\fR unless the current
month is January.)
.TP
.B nextmonthname \fIname\fR
The name of the following month.
.TP
.B daysinnextmonth \fIn\fR
The number of days in the following month.
.TP
.B nextmonthyear \fIyyyy\fR
The year of the following month. (The same as \fByear\fR unless the
current month is December.)
.TP
.B entries \fR[\fIarray\fR]
The \fBentries\fR key consists of an array of calendar entries; each
entry is a JSON object that has the same format as described in the

View File

@@ -501,6 +501,7 @@ static void DoCalendarOneMonth(void)
} else {
PrintJSONKeyPairString("prevmonthname", MonthName[mm]);
PrintJSONKeyPairInt("daysinprevmonth", DaysInMonth(mm, yy));
PrintJSONKeyPairInt("prevmonthyear", yy);
}
mm = m+1;
if (mm>11) {
@@ -511,6 +512,7 @@ static void DoCalendarOneMonth(void)
} else {
PrintJSONKeyPairString("nextmonthname", MonthName[mm]);
PrintJSONKeyPairInt("daysinnextmonth", DaysInMonth(mm, yy));
PrintJSONKeyPairInt("nextmonthyear", yy);
printf("\"entries\":[\n");
}
}

View File

@@ -4989,7 +4989,7 @@ February 29
-stdin-(7): Number too high
[
{
"monthname":"January", "year":2012, "daysinmonth":31, "firstwkday":0, "mondayfirst":0, "daynames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"prevmonthname":"December", "daysinprevmonth":31, "nextmonthname":"February", "daysinnextmonth":29, "entries":[
"monthname":"January", "year":2012, "daysinmonth":31, "firstwkday":0, "mondayfirst":0, "daynames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"prevmonthname":"December", "daysinprevmonth":31, "prevmonthyear":2011, "nextmonthname":"February", "daysinnextmonth":29, "nextmonthyear":2012, "entries":[
{"date":"2012-01-02", "filename":"-", "lineno":1, "d":2, "priority":5000, "body":"Normal"},
{"date":"2012-01-03", "filename":"-", "lineno":3, "passthru":"COLOR", "d":3, "priority":5000, "r":255, "g":0, "b":0, "rawbody":"Red", "body":"255 0 0 Red"},
{"date":"2012-01-04", "filename":"-", "lineno":5, "d":4, "priority":5000, "body":"Normal"}