@bprotsyk/aso-core 1.2.199 → 1.2.201

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.
@@ -10,25 +10,22 @@ function convertMillisToDate(millis) {
10
10
  }
11
11
  exports.convertMillisToDate = convertMillisToDate;
12
12
  function getTimestampsForTodayAndYesterday() {
13
- const now = new Date();
14
- // Today's Start (00:00:00)
13
+ const offset = -2;
14
+ const now = new Date(new Date().getTime() + offset * 3600 * 1000);
15
15
  const todayStart = new Date(now);
16
- todayStart.setHours(0, 0, 0, 0);
17
- const todayStartTimestamp = todayStart.getTime();
18
- // Today's End (23:59:59.999)
16
+ todayStart.setUTCHours(0, 0, 0, 0);
17
+ const todayStartTimestamp = todayStart.getTime() - offset * 3600 * 1000;
19
18
  const todayEnd = new Date(now);
20
- todayEnd.setHours(23, 59, 59, 999);
21
- const todayEndTimestamp = todayEnd.getTime();
22
- // Yesterday's Start (00:00:00)
19
+ todayEnd.setUTCHours(23, 59, 59, 999);
20
+ const todayEndTimestamp = todayEnd.getTime() - offset * 3600 * 1000;
23
21
  const yesterdayStart = new Date(now);
24
- yesterdayStart.setDate(now.getDate() - 1);
25
- yesterdayStart.setHours(0, 0, 0, 0);
26
- const yesterdayStartTimestamp = yesterdayStart.getTime();
27
- // Yesterday's End (23:59:59.999)
22
+ yesterdayStart.setUTCDate(now.getUTCDate() - 1);
23
+ yesterdayStart.setUTCHours(0, 0, 0, 0);
24
+ const yesterdayStartTimestamp = yesterdayStart.getTime() - offset * 3600 * 1000;
28
25
  const yesterdayEnd = new Date(now);
29
- yesterdayEnd.setDate(now.getDate() - 1);
30
- yesterdayEnd.setHours(23, 59, 59, 999);
31
- const yesterdayEndTimestamp = yesterdayEnd.getTime();
26
+ yesterdayEnd.setUTCDate(now.getUTCDate() - 1);
27
+ yesterdayEnd.setUTCHours(23, 59, 59, 999);
28
+ const yesterdayEndTimestamp = yesterdayEnd.getTime() - offset * 3600 * 1000;
32
29
  return {
33
30
  today: {
34
31
  start: todayStartTimestamp,
@@ -332,7 +332,7 @@ async function createFlashCampaigns(app) {
332
332
  // Upserting Flash Redirect campaign
333
333
  let redirectCampaign = await (0, exports.createOrFindFlashRedirectCampaign)(app);
334
334
  console.log(`Redirect campaign name:`);
335
- console.log(`${redirectCampaign.domain}${redirectCampaign.alias}?uid=`);
335
+ console.log(`${redirectCampaign.domain}/${redirectCampaign.alias}?uid=`);
336
336
  // Upserting necessary streams
337
337
  let botProtectionStream = createBPStreamPartialPayload(app);
338
338
  let owStream = createOWStreamPartialPayload(app);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "1.2.199",
3
+ "version": "1.2.201",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
@@ -1,35 +1,28 @@
1
1
  export function convertMillisToDate(millis: number): string {
2
- const date = new Date(millis);
3
- const year = date.getFullYear();
4
- const month = (date.getMonth() + 1).toString().padStart(2, '0');
5
- const day = date.getDate().toString().padStart(2, '0');
6
- return `${year}-${month}-${day}`;
2
+ const date = new Date(millis)
3
+ const year = date.getFullYear()
4
+ const month = (date.getMonth() + 1).toString().padStart(2, '0')
5
+ const day = date.getDate().toString().padStart(2, '0')
6
+ return `${year}-${month}-${day}`
7
7
  }
8
8
 
9
9
  export function getTimestampsForTodayAndYesterday() {
10
- const now = new Date();
11
-
12
- // Today's Start (00:00:00)
13
- const todayStart = new Date(now);
14
- todayStart.setHours(0, 0, 0, 0);
15
- const todayStartTimestamp = todayStart.getTime();
16
-
17
- // Today's End (23:59:59.999)
18
- const todayEnd = new Date(now);
19
- todayEnd.setHours(23, 59, 59, 999);
20
- const todayEndTimestamp = todayEnd.getTime();
21
-
22
- // Yesterday's Start (00:00:00)
23
- const yesterdayStart = new Date(now);
24
- yesterdayStart.setDate(now.getDate() - 1);
25
- yesterdayStart.setHours(0, 0, 0, 0);
26
- const yesterdayStartTimestamp = yesterdayStart.getTime();
27
-
28
- // Yesterday's End (23:59:59.999)
29
- const yesterdayEnd = new Date(now);
30
- yesterdayEnd.setDate(now.getDate() - 1);
31
- yesterdayEnd.setHours(23, 59, 59, 999);
32
- const yesterdayEndTimestamp = yesterdayEnd.getTime();
10
+ const offset = - 2
11
+ const now = new Date(new Date().getTime() + offset * 3600 * 1000)
12
+ const todayStart = new Date(now)
13
+ todayStart.setUTCHours(0, 0, 0, 0)
14
+ const todayStartTimestamp = todayStart.getTime() - offset * 3600 * 1000
15
+ const todayEnd = new Date(now)
16
+ todayEnd.setUTCHours(23, 59, 59, 999)
17
+ const todayEndTimestamp = todayEnd.getTime() - offset * 3600 * 1000
18
+ const yesterdayStart = new Date(now)
19
+ yesterdayStart.setUTCDate(now.getUTCDate() - 1)
20
+ yesterdayStart.setUTCHours(0, 0, 0, 0)
21
+ const yesterdayStartTimestamp = yesterdayStart.getTime() - offset * 3600 * 1000
22
+ const yesterdayEnd = new Date(now)
23
+ yesterdayEnd.setUTCDate(now.getUTCDate() - 1)
24
+ yesterdayEnd.setUTCHours(23, 59, 59, 999)
25
+ const yesterdayEndTimestamp = yesterdayEnd.getTime() - offset * 3600 * 1000
33
26
 
34
27
  return {
35
28
  today: {
@@ -40,5 +33,5 @@ export function getTimestampsForTodayAndYesterday() {
40
33
  start: yesterdayStartTimestamp,
41
34
  end: yesterdayEndTimestamp,
42
35
  },
43
- };
36
+ }
44
37
  }
@@ -359,7 +359,7 @@ export async function createFlashCampaigns(app: IFlashApp) {
359
359
  // Upserting Flash Redirect campaign
360
360
  let redirectCampaign = await createOrFindFlashRedirectCampaign(app)
361
361
  console.log(`Redirect campaign name:`)
362
- console.log(`${redirectCampaign.domain}${redirectCampaign.alias}?uid=`)
362
+ console.log(`${redirectCampaign.domain}/${redirectCampaign.alias}?uid=`)
363
363
 
364
364
  // Upserting necessary streams
365
365
  let botProtectionStream = createBPStreamPartialPayload(app)