tango-app-api-analysis-zone 3.0.0-alpha.27 → 3.0.0-alpha.28

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-analysis-zone",
3
- "version": "3.0.0-alpha.27",
3
+ "version": "3.0.0-alpha.28",
4
4
  "description": "zone Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -180,6 +180,26 @@ export const zoneConcentrationSummaryV2 = async ( req, res ) => {
180
180
  export const overallStoreConcentrationDatesV2 = async ( req, res ) => {
181
181
  try {
182
182
  let reqestData = req.body;
183
+
184
+ const date1 = new Date( reqestData.fromDate );
185
+ const date2 = new Date( reqestData.toDate );
186
+ // Get the difference in milliseconds
187
+ const diffInMs = date2 - date1;
188
+ // Convert milliseconds to days
189
+ let diffInDays = parseInt( diffInMs / ( 1000 * 60 * 60 * 24 ) );
190
+ if ( diffInDays <= 7 ) {
191
+ if ( reqestData.dateType == 'weekly' ) {
192
+ // subtract 7 days to the date
193
+ date2.setDate( date2.getDate() - 7 );
194
+ reqestData.fromDate = date2.toISOString().slice( 0, 10 );
195
+ }
196
+ if ( reqestData.dateType == 'monthly' ) {
197
+ // subtract 31 days to the date
198
+ date2.setDate( date2.getDate() - 31 );
199
+ reqestData.fromDate = date2.toISOString().slice( 0, 10 );
200
+ }
201
+ }
202
+
183
203
  let LamdaURL = 'https://nmjcclomhgdecmoyned3sp6y6q0pemhg.lambda-url.ap-south-1.on.aws/';
184
204
  let resultData = await LamdaServiceCall( LamdaURL, reqestData );
185
205
  if ( resultData ) {