cyc-type-def 3.0.12 → 4.0.0

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/dist/index.cjs CHANGED
@@ -45,7 +45,12 @@ __export(index_exports, {
45
45
  Sheep: () => Sheep,
46
46
  SmallTeam: () => SmallTeam,
47
47
  Title: () => Title,
48
- TitleAttendance: () => TitleAttendance
48
+ TitleAttendance: () => TitleAttendance,
49
+ formatDateDDMMYY: () => formatDateDDMMYY,
50
+ isDateInRangeIgnoreYear: () => isDateInRangeIgnoreYear,
51
+ monthStr: () => monthStr,
52
+ parseYYMMDD: () => parseYYMMDD,
53
+ yearStr: () => yearStr
49
54
  });
50
55
  module.exports = __toCommonJS(index_exports);
51
56
 
@@ -540,6 +545,7 @@ var ClickAction = /* @__PURE__ */ ((ClickAction2) => {
540
545
  ClickAction2[ClickAction2["P_BIRTHDAY"] = 12] = "P_BIRTHDAY";
541
546
  ClickAction2[ClickAction2["P_CLAIM"] = 13] = "P_CLAIM";
542
547
  ClickAction2[ClickAction2["P_SETTING"] = 14] = "P_SETTING";
548
+ ClickAction2[ClickAction2["P_MSJ_STUDENT_RECORD"] = 15] = "P_MSJ_STUDENT_RECORD";
543
549
  return ClickAction2;
544
550
  })(ClickAction || {});
545
551
 
@@ -596,6 +602,41 @@ var MsjJoinStatusInfo = {
596
602
  short: "Refresh"
597
603
  }
598
604
  };
605
+
606
+ // src/util/date.util.ts
607
+ function formatDateDDMMYY(date) {
608
+ const day = String(date.getDate()).padStart(2, "0");
609
+ const month = String(date.getMonth() + 1).padStart(2, "0");
610
+ const year = String(date.getFullYear()).slice(-2);
611
+ return `${year}${month}${day}`;
612
+ }
613
+ function parseYYMMDD(str) {
614
+ const year = 2e3 + parseInt(str.slice(0, 2));
615
+ const month = parseInt(str.slice(2, 4)) - 1;
616
+ const day = parseInt(str.slice(4, 6));
617
+ return new Date(year, month, day);
618
+ }
619
+ function isDateInRangeIgnoreYear(d, start, end) {
620
+ const code = mdCode(d);
621
+ const s = mdCode(start);
622
+ const e = mdCode(end);
623
+ if (s <= e) {
624
+ return code >= s && code <= e;
625
+ } else {
626
+ return code >= s || code <= e;
627
+ }
628
+ }
629
+ function mdCode(date) {
630
+ const m = date.getUTCMonth() + 1;
631
+ const d = date.getUTCDate();
632
+ return m * 100 + d;
633
+ }
634
+ function yearStr(timestamp) {
635
+ return new Date(timestamp).getFullYear().toString();
636
+ }
637
+ function monthStr(timestamp) {
638
+ return new Date(timestamp).toLocaleString("default", { month: "long" });
639
+ }
599
640
  // Annotate the CommonJS export names for ESM import in node:
600
641
  0 && (module.exports = {
601
642
  AppUser,
@@ -623,5 +664,10 @@ var MsjJoinStatusInfo = {
623
664
  Sheep,
624
665
  SmallTeam,
625
666
  Title,
626
- TitleAttendance
667
+ TitleAttendance,
668
+ formatDateDDMMYY,
669
+ isDateInRangeIgnoreYear,
670
+ monthStr,
671
+ parseYYMMDD,
672
+ yearStr
627
673
  });
package/dist/index.d.cts CHANGED
@@ -478,7 +478,8 @@ declare enum ClickAction {
478
478
  F_ExportVerticalView = 11,
479
479
  P_BIRTHDAY = 12,
480
480
  P_CLAIM = 13,
481
- P_SETTING = 14
481
+ P_SETTING = 14,
482
+ P_MSJ_STUDENT_RECORD = 15
482
483
  }
483
484
 
484
485
  declare class Click {
@@ -528,4 +529,15 @@ declare const MsjJoinStatusInfo: Record<MsjJoinStatus, {
528
529
  short: string;
529
530
  }>;
530
531
 
531
- export { type AppPage, AppUser, AssignedCG, AttSheep, Attendance, BackupAttendance, type Base, type BaseDialog, CG, type Claim, ClaimStatus, ClaimType, Click, ClickAction, Cluster, Column, type Device, DisplayAttendance, FollowUpStatus, LIST_STATUS, METHOD, type MsjClassBatch, type MsjClassTime, type MsjClassType, MsjJoinStatus, MsjJoinStatusInfo, type MsjStudBatch, type MsjStudClass, PERMISSION, type PastoralTeam, ReportSheep, Session, SessionAttendance, Sheep, SmallTeam, Title, TitleAttendance };
532
+ declare function formatDateDDMMYY(date: Date): string;
533
+ declare function parseYYMMDD(str: string): Date;
534
+ /**
535
+ * Returns true if `d` is between `start` and `end` by month/day only (inclusive).
536
+ * Year is ignored. Works even when the range crosses year-end.
537
+ * Uses UTC month/day to avoid timezone surprises.
538
+ */
539
+ declare function isDateInRangeIgnoreYear(d: Date, start: Date, end: Date): boolean;
540
+ declare function yearStr(timestamp: number): string;
541
+ declare function monthStr(timestamp: number): string;
542
+
543
+ export { type AppPage, AppUser, AssignedCG, AttSheep, Attendance, BackupAttendance, type Base, type BaseDialog, CG, type Claim, ClaimStatus, ClaimType, Click, ClickAction, Cluster, Column, type Device, DisplayAttendance, FollowUpStatus, LIST_STATUS, METHOD, type MsjClassBatch, type MsjClassTime, type MsjClassType, MsjJoinStatus, MsjJoinStatusInfo, type MsjStudBatch, type MsjStudClass, PERMISSION, type PastoralTeam, ReportSheep, Session, SessionAttendance, Sheep, SmallTeam, Title, TitleAttendance, formatDateDDMMYY, isDateInRangeIgnoreYear, monthStr, parseYYMMDD, yearStr };
package/dist/index.d.ts CHANGED
@@ -478,7 +478,8 @@ declare enum ClickAction {
478
478
  F_ExportVerticalView = 11,
479
479
  P_BIRTHDAY = 12,
480
480
  P_CLAIM = 13,
481
- P_SETTING = 14
481
+ P_SETTING = 14,
482
+ P_MSJ_STUDENT_RECORD = 15
482
483
  }
483
484
 
484
485
  declare class Click {
@@ -528,4 +529,15 @@ declare const MsjJoinStatusInfo: Record<MsjJoinStatus, {
528
529
  short: string;
529
530
  }>;
530
531
 
531
- export { type AppPage, AppUser, AssignedCG, AttSheep, Attendance, BackupAttendance, type Base, type BaseDialog, CG, type Claim, ClaimStatus, ClaimType, Click, ClickAction, Cluster, Column, type Device, DisplayAttendance, FollowUpStatus, LIST_STATUS, METHOD, type MsjClassBatch, type MsjClassTime, type MsjClassType, MsjJoinStatus, MsjJoinStatusInfo, type MsjStudBatch, type MsjStudClass, PERMISSION, type PastoralTeam, ReportSheep, Session, SessionAttendance, Sheep, SmallTeam, Title, TitleAttendance };
532
+ declare function formatDateDDMMYY(date: Date): string;
533
+ declare function parseYYMMDD(str: string): Date;
534
+ /**
535
+ * Returns true if `d` is between `start` and `end` by month/day only (inclusive).
536
+ * Year is ignored. Works even when the range crosses year-end.
537
+ * Uses UTC month/day to avoid timezone surprises.
538
+ */
539
+ declare function isDateInRangeIgnoreYear(d: Date, start: Date, end: Date): boolean;
540
+ declare function yearStr(timestamp: number): string;
541
+ declare function monthStr(timestamp: number): string;
542
+
543
+ export { type AppPage, AppUser, AssignedCG, AttSheep, Attendance, BackupAttendance, type Base, type BaseDialog, CG, type Claim, ClaimStatus, ClaimType, Click, ClickAction, Cluster, Column, type Device, DisplayAttendance, FollowUpStatus, LIST_STATUS, METHOD, type MsjClassBatch, type MsjClassTime, type MsjClassType, MsjJoinStatus, MsjJoinStatusInfo, type MsjStudBatch, type MsjStudClass, PERMISSION, type PastoralTeam, ReportSheep, Session, SessionAttendance, Sheep, SmallTeam, Title, TitleAttendance, formatDateDDMMYY, isDateInRangeIgnoreYear, monthStr, parseYYMMDD, yearStr };
package/dist/index.js CHANGED
@@ -489,6 +489,7 @@ var ClickAction = /* @__PURE__ */ ((ClickAction2) => {
489
489
  ClickAction2[ClickAction2["P_BIRTHDAY"] = 12] = "P_BIRTHDAY";
490
490
  ClickAction2[ClickAction2["P_CLAIM"] = 13] = "P_CLAIM";
491
491
  ClickAction2[ClickAction2["P_SETTING"] = 14] = "P_SETTING";
492
+ ClickAction2[ClickAction2["P_MSJ_STUDENT_RECORD"] = 15] = "P_MSJ_STUDENT_RECORD";
492
493
  return ClickAction2;
493
494
  })(ClickAction || {});
494
495
 
@@ -545,6 +546,41 @@ var MsjJoinStatusInfo = {
545
546
  short: "Refresh"
546
547
  }
547
548
  };
549
+
550
+ // src/util/date.util.ts
551
+ function formatDateDDMMYY(date) {
552
+ const day = String(date.getDate()).padStart(2, "0");
553
+ const month = String(date.getMonth() + 1).padStart(2, "0");
554
+ const year = String(date.getFullYear()).slice(-2);
555
+ return `${year}${month}${day}`;
556
+ }
557
+ function parseYYMMDD(str) {
558
+ const year = 2e3 + parseInt(str.slice(0, 2));
559
+ const month = parseInt(str.slice(2, 4)) - 1;
560
+ const day = parseInt(str.slice(4, 6));
561
+ return new Date(year, month, day);
562
+ }
563
+ function isDateInRangeIgnoreYear(d, start, end) {
564
+ const code = mdCode(d);
565
+ const s = mdCode(start);
566
+ const e = mdCode(end);
567
+ if (s <= e) {
568
+ return code >= s && code <= e;
569
+ } else {
570
+ return code >= s || code <= e;
571
+ }
572
+ }
573
+ function mdCode(date) {
574
+ const m = date.getUTCMonth() + 1;
575
+ const d = date.getUTCDate();
576
+ return m * 100 + d;
577
+ }
578
+ function yearStr(timestamp) {
579
+ return new Date(timestamp).getFullYear().toString();
580
+ }
581
+ function monthStr(timestamp) {
582
+ return new Date(timestamp).toLocaleString("default", { month: "long" });
583
+ }
548
584
  export {
549
585
  AppUser,
550
586
  AssignedCG,
@@ -571,5 +607,10 @@ export {
571
607
  Sheep,
572
608
  SmallTeam,
573
609
  Title,
574
- TitleAttendance
610
+ TitleAttendance,
611
+ formatDateDDMMYY,
612
+ isDateInRangeIgnoreYear,
613
+ monthStr,
614
+ parseYYMMDD,
615
+ yearStr
575
616
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyc-type-def",
3
- "version": "3.0.12",
3
+ "version": "4.0.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",