@gobrand/calendar-core 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +9 -2
- package/dist/index.js +9 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -177,8 +177,12 @@ function buildMonth(year, month, options) {
|
|
|
177
177
|
}
|
|
178
178
|
const weeks = [];
|
|
179
179
|
let currentDate = startDate;
|
|
180
|
-
|
|
180
|
+
let passedLastDay = false;
|
|
181
|
+
while (true) {
|
|
181
182
|
if (weeks.length === 0 || weeks[weeks.length - 1].length === 7) {
|
|
183
|
+
if (passedLastDay) {
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
182
186
|
weeks.push([]);
|
|
183
187
|
}
|
|
184
188
|
const dateKey = currentDate.toString();
|
|
@@ -188,8 +192,11 @@ function buildMonth(year, month, options) {
|
|
|
188
192
|
isToday: import_polyfill2.Temporal.PlainDate.compare(currentDate, today) === 0,
|
|
189
193
|
items: itemsByDate.get(dateKey) ?? []
|
|
190
194
|
});
|
|
195
|
+
if (import_polyfill2.Temporal.PlainDate.compare(currentDate, lastOfMonth) >= 0) {
|
|
196
|
+
passedLastDay = true;
|
|
197
|
+
}
|
|
191
198
|
currentDate = currentDate.add({ days: 1 });
|
|
192
|
-
if (
|
|
199
|
+
if (passedLastDay && weeks[weeks.length - 1].length === 7) {
|
|
193
200
|
break;
|
|
194
201
|
}
|
|
195
202
|
}
|
package/dist/index.js
CHANGED
|
@@ -123,8 +123,12 @@ function buildMonth(year, month, options) {
|
|
|
123
123
|
}
|
|
124
124
|
const weeks = [];
|
|
125
125
|
let currentDate = startDate;
|
|
126
|
-
|
|
126
|
+
let passedLastDay = false;
|
|
127
|
+
while (true) {
|
|
127
128
|
if (weeks.length === 0 || weeks[weeks.length - 1].length === 7) {
|
|
129
|
+
if (passedLastDay) {
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
128
132
|
weeks.push([]);
|
|
129
133
|
}
|
|
130
134
|
const dateKey = currentDate.toString();
|
|
@@ -134,8 +138,11 @@ function buildMonth(year, month, options) {
|
|
|
134
138
|
isToday: Temporal2.PlainDate.compare(currentDate, today) === 0,
|
|
135
139
|
items: itemsByDate.get(dateKey) ?? []
|
|
136
140
|
});
|
|
141
|
+
if (Temporal2.PlainDate.compare(currentDate, lastOfMonth) >= 0) {
|
|
142
|
+
passedLastDay = true;
|
|
143
|
+
}
|
|
137
144
|
currentDate = currentDate.add({ days: 1 });
|
|
138
|
-
if (
|
|
145
|
+
if (passedLastDay && weeks[weeks.length - 1].length === 7) {
|
|
139
146
|
break;
|
|
140
147
|
}
|
|
141
148
|
}
|