@osimatic/helpers-js 1.1.49 → 1.1.51
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/date_time.js +2 -1
- package/form_date.js +4 -6
- package/package.json +1 -1
package/date_time.js
CHANGED
|
@@ -180,7 +180,8 @@ class DateTime {
|
|
|
180
180
|
|
|
181
181
|
static getFirstDayOfWeek(date) {
|
|
182
182
|
let firstDayOfWeek = new Date(date);
|
|
183
|
-
|
|
183
|
+
const day = date.getDay();
|
|
184
|
+
firstDayOfWeek.setDate(date.getDate() - day + (0 === day ? -6:1)); // First day is the day of the month - the day of the week
|
|
184
185
|
return firstDayOfWeek;
|
|
185
186
|
}
|
|
186
187
|
|
package/form_date.js
CHANGED
|
@@ -48,7 +48,7 @@ class InputPeriod {
|
|
|
48
48
|
link.click(function() { InputPeriod.selectCurrentYear($(this)); return false; });
|
|
49
49
|
}
|
|
50
50
|
if ((link = form.find('a.period_select_last_year')).length) {
|
|
51
|
-
link.click(function() { InputPeriod.
|
|
51
|
+
link.click(function() { InputPeriod.selectPreviousYear($(this), 1); return false; });
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -110,15 +110,13 @@ class InputPeriod {
|
|
|
110
110
|
static selectPeriod(link, startDate, endDate) {
|
|
111
111
|
let inputPeriodStart = link.parent().parent().find('input[type="date"]').filter('[name="date_start"], [name="start_date"], [name="start_period"], [name="period_start_date"]');
|
|
112
112
|
let inputPeriodEnd = link.parent().parent().find('input[type="date"]').filter('[name="date_end"], [name="end_date"], [name="end_period"], [name="period_end_date"]');
|
|
113
|
-
if (inputPeriodStart.length
|
|
113
|
+
if (inputPeriodStart.length === 0 || inputPeriodEnd.length === 0) {
|
|
114
114
|
console.log('no period input found');
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
inputPeriodStart.val(DateTime.getSqlDate(startDate));
|
|
121
|
-
inputPeriodEnd.val(DateTime.getSqlDate(endDate));
|
|
118
|
+
inputPeriodStart.val(DateTime.getDateForInputDate(startDate));
|
|
119
|
+
inputPeriodEnd.val(DateTime.getDateForInputDate(endDate));
|
|
122
120
|
}
|
|
123
121
|
|
|
124
122
|
}
|