Skip to content

Commit 4cf74a4

Browse files
authored
Merge pull request #423 from aldabil21/fix-rrule-import
Fix: move convertDateToRRuleDate outside lib
2 parents 2e5ad03 + c6a360a commit 4cf74a4

3 files changed

Lines changed: 13 additions & 25 deletions

File tree

src/events.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { RRule } from "rrule";
1+
import { datetime, RRule } from "rrule";
22
import { ProcessedEvent } from "./lib/types";
3-
import { convertDateToRRuleDate } from "./lib/helpers/generals";
43

54
export const EVENTS: ProcessedEvent[] = [
65
{
@@ -204,3 +203,13 @@ export const generateRandomEvents = (total = 300) => {
204203

205204
return events;
206205
};
206+
207+
function convertDateToRRuleDate(date: Date) {
208+
return datetime(
209+
date.getFullYear(),
210+
date.getMonth() + 1,
211+
date.getDate(),
212+
date.getHours(),
213+
date.getMinutes()
214+
);
215+
}

src/lib/helpers/generals.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
SchedulerProps,
2222
} from "../types";
2323
import { StateEvent } from "../views/Editor";
24-
import { datetime } from "rrule";
2524

2625
export const getOneView = (state: Partial<SchedulerProps>): View => {
2726
if (state.month) {
@@ -126,16 +125,6 @@ export const differenceInDaysOmitTime = (start: Date, end: Date) => {
126125
return differenceInDays(endOfDay(addSeconds(end, -1)), startOfDay(start));
127126
};
128127

129-
export const convertDateToRRuleDate = (date: Date) => {
130-
return datetime(
131-
date.getFullYear(),
132-
date.getMonth() + 1,
133-
date.getDate(),
134-
date.getHours(),
135-
date.getMinutes()
136-
);
137-
};
138-
139128
export const convertRRuleDateToDate = (rruleDate: Date) => {
140129
return new Date(
141130
rruleDate.getUTCFullYear(),

vite.config.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { defineConfig } from "vite";
44
import react from "@vitejs/plugin-react";
55
import dts from "vite-plugin-dts";
66
import tsconfigPaths from "vite-tsconfig-paths";
7-
import { peerDependencies } from "./package.json";
7+
import peerDepsExternal from "rollup-plugin-peer-deps-external";
88

99
const __dirname = dirname(fileURLToPath(import.meta.url));
1010

@@ -15,6 +15,7 @@ export default defineConfig(() => ({
1515
configNames: ["tsconfig.json"],
1616
}),
1717
dts({ tsconfigPath: "./tsconfig.build.json" }),
18+
peerDepsExternal(),
1819
],
1920
server: {
2021
port: 3000,
@@ -31,17 +32,6 @@ export default defineConfig(() => ({
3132
name: "Scheduler",
3233
formats: ["es"],
3334
},
34-
rollupOptions: {
35-
external: (path) => {
36-
const nodeModules = path.includes("node_modules");
37-
const isPeer = Object.keys(peerDependencies).some((dep) => path.startsWith(dep));
38-
const isExternal = nodeModules || isPeer;
39-
return isExternal;
40-
},
41-
output: {
42-
globals: (path) => path,
43-
},
44-
},
4535
copyPublicDir: false,
4636
},
4737
resolve: {

0 commit comments

Comments
 (0)