cyc-type-def 3.0.11 → 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
 
@@ -539,6 +544,8 @@ var ClickAction = /* @__PURE__ */ ((ClickAction2) => {
539
544
  ClickAction2[ClickAction2["F_ExportVerticalView"] = 11] = "F_ExportVerticalView";
540
545
  ClickAction2[ClickAction2["P_BIRTHDAY"] = 12] = "P_BIRTHDAY";
541
546
  ClickAction2[ClickAction2["P_CLAIM"] = 13] = "P_CLAIM";
547
+ ClickAction2[ClickAction2["P_SETTING"] = 14] = "P_SETTING";
548
+ ClickAction2[ClickAction2["P_MSJ_STUDENT_RECORD"] = 15] = "P_MSJ_STUDENT_RECORD";
542
549
  return ClickAction2;
543
550
  })(ClickAction || {});
544
551
 
@@ -595,6 +602,41 @@ var MsjJoinStatusInfo = {
595
602
  short: "Refresh"
596
603
  }
597
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
+ }
598
640
  // Annotate the CommonJS export names for ESM import in node:
599
641
  0 && (module.exports = {
600
642
  AppUser,
@@ -622,5 +664,10 @@ var MsjJoinStatusInfo = {
622
664
  Sheep,
623
665
  SmallTeam,
624
666
  Title,
625
- TitleAttendance
667
+ TitleAttendance,
668
+ formatDateDDMMYY,
669
+ isDateInRangeIgnoreYear,
670
+ monthStr,
671
+ parseYYMMDD,
672
+ yearStr
626
673
  });
package/dist/index.d.cts CHANGED
@@ -454,7 +454,7 @@ declare class AppUser {
454
454
  assigned_cg?: AssignedCG[];
455
455
  idSheep?: string;
456
456
  settings?: {
457
- [key: string]: boolean;
457
+ [key: string]: boolean | string;
458
458
  };
459
459
  constructor(id: string, name: string, phoneNum: string, permission: string);
460
460
  }
@@ -477,7 +477,9 @@ declare enum ClickAction {
477
477
  F_ExportAttRpt = 10,
478
478
  F_ExportVerticalView = 11,
479
479
  P_BIRTHDAY = 12,
480
- P_CLAIM = 13
480
+ P_CLAIM = 13,
481
+ P_SETTING = 14,
482
+ P_MSJ_STUDENT_RECORD = 15
481
483
  }
482
484
 
483
485
  declare class Click {
@@ -527,4 +529,15 @@ declare const MsjJoinStatusInfo: Record<MsjJoinStatus, {
527
529
  short: string;
528
530
  }>;
529
531
 
530
- 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
@@ -454,7 +454,7 @@ declare class AppUser {
454
454
  assigned_cg?: AssignedCG[];
455
455
  idSheep?: string;
456
456
  settings?: {
457
- [key: string]: boolean;
457
+ [key: string]: boolean | string;
458
458
  };
459
459
  constructor(id: string, name: string, phoneNum: string, permission: string);
460
460
  }
@@ -477,7 +477,9 @@ declare enum ClickAction {
477
477
  F_ExportAttRpt = 10,
478
478
  F_ExportVerticalView = 11,
479
479
  P_BIRTHDAY = 12,
480
- P_CLAIM = 13
480
+ P_CLAIM = 13,
481
+ P_SETTING = 14,
482
+ P_MSJ_STUDENT_RECORD = 15
481
483
  }
482
484
 
483
485
  declare class Click {
@@ -527,4 +529,15 @@ declare const MsjJoinStatusInfo: Record<MsjJoinStatus, {
527
529
  short: string;
528
530
  }>;
529
531
 
530
- 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
@@ -488,6 +488,8 @@ var ClickAction = /* @__PURE__ */ ((ClickAction2) => {
488
488
  ClickAction2[ClickAction2["F_ExportVerticalView"] = 11] = "F_ExportVerticalView";
489
489
  ClickAction2[ClickAction2["P_BIRTHDAY"] = 12] = "P_BIRTHDAY";
490
490
  ClickAction2[ClickAction2["P_CLAIM"] = 13] = "P_CLAIM";
491
+ ClickAction2[ClickAction2["P_SETTING"] = 14] = "P_SETTING";
492
+ ClickAction2[ClickAction2["P_MSJ_STUDENT_RECORD"] = 15] = "P_MSJ_STUDENT_RECORD";
491
493
  return ClickAction2;
492
494
  })(ClickAction || {});
493
495
 
@@ -544,6 +546,41 @@ var MsjJoinStatusInfo = {
544
546
  short: "Refresh"
545
547
  }
546
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
+ }
547
584
  export {
548
585
  AppUser,
549
586
  AssignedCG,
@@ -570,5 +607,10 @@ export {
570
607
  Sheep,
571
608
  SmallTeam,
572
609
  Title,
573
- TitleAttendance
610
+ TitleAttendance,
611
+ formatDateDDMMYY,
612
+ isDateInRangeIgnoreYear,
613
+ monthStr,
614
+ parseYYMMDD,
615
+ yearStr
574
616
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyc-type-def",
3
- "version": "3.0.11",
3
+ "version": "4.0.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",