Skip to content

Commit

Permalink
startOfDay
Browse files Browse the repository at this point in the history
  • Loading branch information
ogroppo committed May 10, 2024
1 parent 68d64a0 commit 049d252
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# deverything

## 0.51.0

### Minor Changes

- startOfDay

## 0.50.0

### Minor Changes
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "deverything",
"version": "0.50.0",
"version": "0.51.0",
"description": "Everything you need for Dev",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand All @@ -17,7 +17,7 @@
"lint": "TIMING=1 eslint src --fix",
"prepublish": "pnpm test && pnpm build",
"test": "jest",
"bump": "pnpm changeset && pnpm changeset version"
"release": "pnpm changeset && pnpm changeset version"
},
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions src/dates/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ export * from "./isOver18";
export * from "./startOfNextMonth";
export * from "./startOfNextWeek";
export * from "./startOfThisWeek";
export * from "./startOfDay";
export * from "./startOfToday";
export * from "./startOfTomorrow";
3 changes: 3 additions & 0 deletions src/dates/startOfDay.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const startOfDay = (day: Date): Date => {
return new Date(day.getFullYear(), day.getMonth(), day.getDate());
};
6 changes: 4 additions & 2 deletions src/dates/startOfToday.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const startOfToday = () => {
import { startOfDay } from "./startOfDay";

export const startOfToday = (): Date => {
const now = new Date();
return new Date(now.getFullYear(), now.getMonth(), now.getDate());
return startOfDay(now);
};

0 comments on commit 049d252

Please sign in to comment.