Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: move convertDateToRRuleDate outside lib #423

Merged
merged 1 commit into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/events.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { RRule } from "rrule";
import { datetime, RRule } from "rrule";
import { ProcessedEvent } from "./lib/types";
import { convertDateToRRuleDate } from "./lib/helpers/generals";

export const EVENTS: ProcessedEvent[] = [
{
Expand Down Expand Up @@ -204,3 +203,13 @@ export const generateRandomEvents = (total = 300) => {

return events;
};

function convertDateToRRuleDate(date: Date) {
return datetime(
date.getFullYear(),
date.getMonth() + 1,
date.getDate(),
date.getHours(),
date.getMinutes()
);
}
11 changes: 0 additions & 11 deletions src/lib/helpers/generals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
SchedulerProps,
} from "../types";
import { StateEvent } from "../views/Editor";
import { datetime } from "rrule";

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

export const convertDateToRRuleDate = (date: Date) => {
return datetime(
date.getFullYear(),
date.getMonth() + 1,
date.getDate(),
date.getHours(),
date.getMinutes()
);
};

export const convertRRuleDateToDate = (rruleDate: Date) => {
return new Date(
rruleDate.getUTCFullYear(),
Expand Down
14 changes: 2 additions & 12 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import dts from "vite-plugin-dts";
import tsconfigPaths from "vite-tsconfig-paths";
import { peerDependencies } from "./package.json";
import peerDepsExternal from "rollup-plugin-peer-deps-external";

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

Expand All @@ -15,6 +15,7 @@ export default defineConfig(() => ({
configNames: ["tsconfig.json"],
}),
dts({ tsconfigPath: "./tsconfig.build.json" }),
peerDepsExternal(),
],
server: {
port: 3000,
Expand All @@ -31,17 +32,6 @@ export default defineConfig(() => ({
name: "Scheduler",
formats: ["es"],
},
rollupOptions: {
external: (path) => {
const nodeModules = path.includes("node_modules");
const isPeer = Object.keys(peerDependencies).some((dep) => path.startsWith(dep));
const isExternal = nodeModules || isPeer;
return isExternal;
},
output: {
globals: (path) => path,
},
},
copyPublicDir: false,
},
resolve: {
Expand Down
Loading