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

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.26",
3
+ "version": "3.0.0-alpha.27",
4
4
  "description": "zone Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -194,6 +194,26 @@ export const zoneConcentrationSummaryTableV1 = async ( req, res ) => {
194
194
  export const zoneHeatmapAvailableDatesV1 = async ( req, res ) => {
195
195
  try {
196
196
  let reqestData = req.body;
197
+
198
+ const date1 = new Date( reqestData.fromDate );
199
+ const date2 = new Date( reqestData.toDate );
200
+ // Get the difference in milliseconds
201
+ const diffInMs = date2 - date1;
202
+ // Convert milliseconds to days
203
+ let diffInDays = parseInt( diffInMs / ( 1000 * 60 * 60 * 24 ) );
204
+ if ( diffInDays <= 7 ) {
205
+ if ( reqestData.dateType == 'weekly' ) {
206
+ // subtract 7 days to the date
207
+ date2.setDate( date2.getDate() - 7 );
208
+ reqestData.fromDate = date2.toISOString().slice( 0, 10 );
209
+ }
210
+ if ( reqestData.dateType == 'monthly' ) {
211
+ // subtract 31 days to the date
212
+ date2.setDate( date2.getDate() - 31 );
213
+ reqestData.fromDate = date2.toISOString().slice( 0, 10 );
214
+ }
215
+ }
216
+
197
217
  let LamdaURL = 'https://tgtkai5zzq7fhp7ymtsnm3a2lm0czulr.lambda-url.ap-south-1.on.aws/';
198
218
  let resultData = await LamdaServiceCall( LamdaURL, reqestData );
199
219
  if ( resultData ) {