@optifye/dashboard-core 6.1.12 → 6.1.13

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.js CHANGED
@@ -1132,9 +1132,14 @@ var dashboardService = {
1132
1132
  const companyId = entityConfig.companyId;
1133
1133
  const metricsTablePrefixStr = getMetricsTablePrefix();
1134
1134
  const metricsTable = `${metricsTablePrefixStr}_${companyId ? companyId.replace(/-/g, "_") : "unknown_company"}`;
1135
- const startDate = new Date(year, month - 1, 1);
1136
- const endDate = new Date(year, month, 0);
1137
- const formatDate = (date) => date.toISOString().split("T")[0];
1135
+ const startDate = new Date(year, month, 1);
1136
+ const endDate = new Date(year, month + 1, 0);
1137
+ const formatDate = (date) => {
1138
+ const year2 = date.getFullYear();
1139
+ const month2 = String(date.getMonth() + 1).padStart(2, "0");
1140
+ const day = String(date.getDate()).padStart(2, "0");
1141
+ return `${year2}-${month2}-${day}`;
1142
+ };
1138
1143
  const formattedStartDate = formatDate(startDate);
1139
1144
  const formattedEndDate = formatDate(endDate);
1140
1145
  try {
@@ -1170,7 +1175,12 @@ var dashboardService = {
1170
1175
  const factoryViewId = entityConfig.factoryViewId ?? "factory";
1171
1176
  const startDate = new Date(year, month, 1);
1172
1177
  const endDate = new Date(year, month + 1, 0);
1173
- const formatDate = (date) => date.toISOString().split("T")[0];
1178
+ const formatDate = (date) => {
1179
+ const year2 = date.getFullYear();
1180
+ const month2 = String(date.getMonth() + 1).padStart(2, "0");
1181
+ const day = String(date.getDate()).padStart(2, "0");
1182
+ return `${year2}-${month2}-${day}`;
1183
+ };
1174
1184
  const formattedStartDate = formatDate(startDate);
1175
1185
  const formattedEndDate = formatDate(endDate);
1176
1186
  let query = supabase.from(lineMetricsTable).select("date, shift_id, avg_efficiency, underperforming_workspaces, total_workspaces").gte("date", formattedStartDate).lte("date", formattedEndDate);
@@ -25535,7 +25545,7 @@ var WorkspaceMonthlyDataFetcher = ({
25535
25545
  if (!workspaceId) return;
25536
25546
  const fetchMonthlyData = async () => {
25537
25547
  onLoadingChange(true);
25538
- console.log(`[fetchMonthlyData] Starting fetch for workspace ${workspaceId}, month: ${selectedMonth + 1}, year: ${selectedYear}`);
25548
+ console.log(`[fetchMonthlyData] Starting fetch for workspace ${workspaceId}, month: ${selectedMonth}, year: ${selectedYear}`);
25539
25549
  try {
25540
25550
  if (!supabase) {
25541
25551
  console.error("Supabase client not available for fetching monthly data");
@@ -25544,8 +25554,8 @@ var WorkspaceMonthlyDataFetcher = ({
25544
25554
  }
25545
25555
  const fetchedMonthlyMetrics = await dashboardService.getWorkspaceMonthlyData(
25546
25556
  workspaceId,
25547
- selectedMonth + 1,
25548
- // Convert 0-based month to 1-based for the service
25557
+ selectedMonth,
25558
+ // Pass 0-based month directly (service now expects 0-based)
25549
25559
  selectedYear
25550
25560
  );
25551
25561
  console.log(`[fetchMonthlyData] Received data:`, {
package/dist/index.mjs CHANGED
@@ -1103,9 +1103,14 @@ var dashboardService = {
1103
1103
  const companyId = entityConfig.companyId;
1104
1104
  const metricsTablePrefixStr = getMetricsTablePrefix();
1105
1105
  const metricsTable = `${metricsTablePrefixStr}_${companyId ? companyId.replace(/-/g, "_") : "unknown_company"}`;
1106
- const startDate = new Date(year, month - 1, 1);
1107
- const endDate = new Date(year, month, 0);
1108
- const formatDate = (date) => date.toISOString().split("T")[0];
1106
+ const startDate = new Date(year, month, 1);
1107
+ const endDate = new Date(year, month + 1, 0);
1108
+ const formatDate = (date) => {
1109
+ const year2 = date.getFullYear();
1110
+ const month2 = String(date.getMonth() + 1).padStart(2, "0");
1111
+ const day = String(date.getDate()).padStart(2, "0");
1112
+ return `${year2}-${month2}-${day}`;
1113
+ };
1109
1114
  const formattedStartDate = formatDate(startDate);
1110
1115
  const formattedEndDate = formatDate(endDate);
1111
1116
  try {
@@ -1141,7 +1146,12 @@ var dashboardService = {
1141
1146
  const factoryViewId = entityConfig.factoryViewId ?? "factory";
1142
1147
  const startDate = new Date(year, month, 1);
1143
1148
  const endDate = new Date(year, month + 1, 0);
1144
- const formatDate = (date) => date.toISOString().split("T")[0];
1149
+ const formatDate = (date) => {
1150
+ const year2 = date.getFullYear();
1151
+ const month2 = String(date.getMonth() + 1).padStart(2, "0");
1152
+ const day = String(date.getDate()).padStart(2, "0");
1153
+ return `${year2}-${month2}-${day}`;
1154
+ };
1145
1155
  const formattedStartDate = formatDate(startDate);
1146
1156
  const formattedEndDate = formatDate(endDate);
1147
1157
  let query = supabase.from(lineMetricsTable).select("date, shift_id, avg_efficiency, underperforming_workspaces, total_workspaces").gte("date", formattedStartDate).lte("date", formattedEndDate);
@@ -25506,7 +25516,7 @@ var WorkspaceMonthlyDataFetcher = ({
25506
25516
  if (!workspaceId) return;
25507
25517
  const fetchMonthlyData = async () => {
25508
25518
  onLoadingChange(true);
25509
- console.log(`[fetchMonthlyData] Starting fetch for workspace ${workspaceId}, month: ${selectedMonth + 1}, year: ${selectedYear}`);
25519
+ console.log(`[fetchMonthlyData] Starting fetch for workspace ${workspaceId}, month: ${selectedMonth}, year: ${selectedYear}`);
25510
25520
  try {
25511
25521
  if (!supabase) {
25512
25522
  console.error("Supabase client not available for fetching monthly data");
@@ -25515,8 +25525,8 @@ var WorkspaceMonthlyDataFetcher = ({
25515
25525
  }
25516
25526
  const fetchedMonthlyMetrics = await dashboardService.getWorkspaceMonthlyData(
25517
25527
  workspaceId,
25518
- selectedMonth + 1,
25519
- // Convert 0-based month to 1-based for the service
25528
+ selectedMonth,
25529
+ // Pass 0-based month directly (service now expects 0-based)
25520
25530
  selectedYear
25521
25531
  );
25522
25532
  console.log(`[fetchMonthlyData] Received data:`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optifye/dashboard-core",
3
- "version": "6.1.12",
3
+ "version": "6.1.13",
4
4
  "description": "Reusable UI & logic for Optifye dashboard",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",