make-mp-data 1.1.17 → 1.1.18

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.
Files changed (2) hide show
  1. package/index.js +5 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -479,8 +479,8 @@ function AKsTimeSoup(earliestTime, latestTime = NOW, peakDays = PEAK_DAYS) {
479
479
 
480
480
  if (typeof earliestTime !== "number") {
481
481
  if (parseInt(earliestTime) > 0) earliestTime = parseInt(earliestTime);
482
- if (dayjs(earliestTime).isValid()) earliestTime = dayjs(earliestTime).unix();
483
- }
482
+ if (dayjs(earliestTime).isValid()) earliestTime = dayjs(earliestTime).unix();
483
+ }
484
484
 
485
485
  while (!validTime) {
486
486
 
@@ -506,7 +506,7 @@ function AKsTimeSoup(earliestTime, latestTime = NOW, peakDays = PEAK_DAYS) {
506
506
  // Generate a random time within business hours with a higher concentration in the middle of the period
507
507
  const businessStart = dayjs.unix(selectedDay).hour(peakStartHour).minute(0).second(0).unix();
508
508
  const businessEnd = dayjs.unix(selectedDay).hour(peakEndHour).minute(0).second(0).unix();
509
-
509
+
510
510
  if (selectedDay === peakDays[0]) {
511
511
  // Use a skewed distribution for peak days
512
512
  eventTime = chance.normal({ mean: (businessEnd + businessStart) / integer(1, 4), dev: (businessEnd - businessStart) / integer(2, 8) });
@@ -519,6 +519,8 @@ function AKsTimeSoup(earliestTime, latestTime = NOW, peakDays = PEAK_DAYS) {
519
519
  if (chance.bool({ likelihood: 42 })) eventTime = Math.min(Math.max(eventTime, businessStart), businessEnd);
520
520
 
521
521
  if (eventTime > 0) validTime = true;
522
+ const parsedTime = dayjs.unix(eventTime).toISOString();
523
+ if (!parsedTime.startsWith('20')) validTime = false;
522
524
 
523
525
  }
524
526
  chosenTime = dayjs.unix(eventTime).toISOString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "make-mp-data",
3
- "version": "1.1.17",
3
+ "version": "1.1.18",
4
4
  "description": "builds all mixpanel primitives for a given project",
5
5
  "main": "index.js",
6
6
  "types": "types.d.ts",