@singi-labs/sifa-sdk 0.19.41 → 0.19.43

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.
@@ -1715,10 +1715,24 @@ function removeOrgNotificationEmail(config, body, options = {}) {
1715
1715
  );
1716
1716
  }
1717
1717
 
1718
+ // src/logic/date-lookahead.ts
1719
+ function isBeyondLookahead(value, months, now = /* @__PURE__ */ new Date()) {
1720
+ const match = /^(\d{4})(?:-(\d{2}))?/.exec(value);
1721
+ if (!match) return false;
1722
+ const index = Number(match[1]) * 12 + (match[2] ? Number(match[2]) : 1);
1723
+ const limit = now.getFullYear() * 12 + now.getMonth() + 1 + months;
1724
+ return index > limit;
1725
+ }
1726
+ function isUpcomingStart(startedAt, now = /* @__PURE__ */ new Date()) {
1727
+ return !!startedAt && isBeyondLookahead(startedAt, 0, now);
1728
+ }
1729
+
1718
1730
  // src/logic/primary-position.ts
1719
- function pickPrimaryPosition(positions) {
1731
+ function pickPrimaryPosition(positions, now = /* @__PURE__ */ new Date()) {
1720
1732
  if (!positions || positions.length === 0) return void 0;
1721
- const active = positions.filter((p) => !p.endedAt && !p.hidden);
1733
+ const active = positions.filter(
1734
+ (p) => !p.endedAt && !p.hidden && !isUpcomingStart(p.startedAt, now)
1735
+ );
1722
1736
  if (active.length === 0) return void 0;
1723
1737
  const flagged = active.find((p) => p.primary === true);
1724
1738
  if (flagged) return flagged;