@shisyamo4131/air-guard-v2-schemas 1.2.0 → 1.2.1
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/package.json
CHANGED
package/src/OperationResult.js
CHANGED
|
@@ -247,7 +247,7 @@ export default class OperationResult extends Operation {
|
|
|
247
247
|
_cutoffDate = v;
|
|
248
248
|
// Update billingDateAt when cutoffDate changes
|
|
249
249
|
if (this.dateAt) {
|
|
250
|
-
this.billingDateAt = CutoffDate.
|
|
250
|
+
this.billingDateAt = CutoffDate.calculateBillingDateAt(
|
|
251
251
|
this.dateAt,
|
|
252
252
|
this.cutoffDate
|
|
253
253
|
);
|
|
@@ -432,7 +432,7 @@ export default class OperationResult extends Operation {
|
|
|
432
432
|
setDateAtCallback(v) {
|
|
433
433
|
super.setDateAtCallback(v);
|
|
434
434
|
if (!this.cutoffDate) return;
|
|
435
|
-
this.billingDateAt = CutoffDate.
|
|
435
|
+
this.billingDateAt = CutoffDate.calculateBillingDateAt(v, this.cutoffDate);
|
|
436
436
|
}
|
|
437
437
|
|
|
438
438
|
/**
|
package/src/utils/CutoffDate.js
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* @static {Array} OPTIONS - Options for selection components
|
|
12
12
|
* @static {function} calculateActualCutoffDay - Calculate actual cutoff day for given year/month
|
|
13
13
|
* @static {function} calculateBillingPeriod - Calculate billing period for given date and cutoff
|
|
14
|
-
* @static {function}
|
|
15
|
-
* @static {function}
|
|
14
|
+
* @static {function} calculateBillingDateAt - Calculate cutoff date as Date object for given sales date
|
|
15
|
+
* @static {function} calculateBillingDateAtString - Calculate cutoff date as string (YYYY-MM-DD) for given sales date
|
|
16
16
|
* @static {function} getDisplayText - Get display text for cutoff date value
|
|
17
17
|
* @static {function} isValidCutoffDate - Validate cutoff date value
|
|
18
18
|
*****************************************************************************/
|
|
@@ -179,14 +179,14 @@ export default class CutoffDate {
|
|
|
179
179
|
* @example
|
|
180
180
|
* // For JST 2024-03-15 with 10th cutoff
|
|
181
181
|
* // Input: UTC date representing JST 2024-03-15
|
|
182
|
-
* const cutoffDate = CutoffDate.
|
|
182
|
+
* const cutoffDate = CutoffDate.calculateBillingDateAt(new Date('2024-03-14T15:00:00Z'), CutoffDate.VALUES.DAY_10);
|
|
183
183
|
* // Returns: UTC date representing JST 2024-04-10
|
|
184
184
|
*
|
|
185
185
|
* // For JST 2024-03-05 with 10th cutoff
|
|
186
|
-
* const cutoffDate = CutoffDate.
|
|
186
|
+
* const cutoffDate = CutoffDate.calculateBillingDateAt(new Date('2024-03-04T15:00:00Z'), CutoffDate.VALUES.DAY_10);
|
|
187
187
|
* // Returns: UTC date representing JST 2024-03-10
|
|
188
188
|
*/
|
|
189
|
-
static
|
|
189
|
+
static calculateBillingDateAt(salesDate, cutoffDateValue) {
|
|
190
190
|
// Convert UTC to JST by adding 9 hours to get the JST date
|
|
191
191
|
const jstDate = new Date(salesDate.getTime() + 9 * 60 * 60 * 1000);
|
|
192
192
|
const year = jstDate.getUTCFullYear();
|
|
@@ -230,11 +230,11 @@ export default class CutoffDate {
|
|
|
230
230
|
* @returns {string} Cutoff date in YYYY-MM-DD format (JST)
|
|
231
231
|
* @example
|
|
232
232
|
* // For JST 2024-03-15 with 10th cutoff
|
|
233
|
-
* const cutoffDateString = CutoffDate.
|
|
233
|
+
* const cutoffDateString = CutoffDate.calculateBillingDateAtString(new Date('2024-03-14T15:00:00Z'), CutoffDate.VALUES.DAY_10);
|
|
234
234
|
* // Returns "2024-04-10"
|
|
235
235
|
*/
|
|
236
|
-
static
|
|
237
|
-
const cutoffDate = CutoffDate.
|
|
236
|
+
static calculateBillingDateAtString(salesDate, cutoffDateValue) {
|
|
237
|
+
const cutoffDate = CutoffDate.calculateBillingDateAt(
|
|
238
238
|
salesDate,
|
|
239
239
|
cutoffDateValue
|
|
240
240
|
);
|