-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update: Allow also minutes and hours
- Loading branch information
Showing
22 changed files
with
892 additions
and
1,890 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": ["eslint:recommended", "plugin:prettier/recommended"], | ||
"parserOptions": { | ||
"ecmaVersion": 2020, | ||
"sourceType": "module" | ||
}, | ||
"env": { | ||
"es6": true, | ||
"browser": true, | ||
"node": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
/.github export-ignore | ||
/Resources/Private/Editor export-ignore | ||
/.editorconfig export-ignore | ||
/.eslintignore export-ignore | ||
/.eslintrc export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.jshintrc export-ignore | ||
/.nvmrc export-ignore | ||
/.prettierignore export-ignore | ||
/.prettierrc export-ignore | ||
/build.mjs export-ignore | ||
/CODE_OF_CONDUCT export-ignore | ||
/eslint.config.js export-ignore | ||
/Makefile export-ignore | ||
/package.json export-ignore | ||
/pnpm-lock.yaml export-ignore | ||
/tsconfig.json export-ignore | ||
/types.d.ts export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"esversion": 6, | ||
"asi": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
20 | ||
22 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,37 @@ | ||
function formatDate(date) { | ||
return date.toISOString().split("T")[0]; | ||
} | ||
|
||
export default function getDate(options, formatDateFunction = formatDate) { | ||
export default function getDate(options, formatDateFunction) { | ||
if (!options) { | ||
return null; | ||
} | ||
|
||
const { unit, amount } = options; | ||
if (typeof amount != "number") { | ||
return null; | ||
} | ||
|
||
if (!formatDateFunction) { | ||
if (unit === "hour" || unit === "minute") { | ||
formatDateFunction = (date) => date.toISOString(); | ||
} else { | ||
formatDateFunction = (date) => date.toISOString().split("T")[0]; | ||
} | ||
} | ||
|
||
const date = new Date(); | ||
if (amount == 0) { | ||
return formatDateFunction(date); | ||
} | ||
|
||
if (unit == "year") { | ||
return formatDateFunction(new Date(date.setFullYear(date.getFullYear() + amount))); | ||
} | ||
|
||
if (unit == "month") { | ||
return formatDateFunction(new Date(date.setMonth(date.getMonth() + amount))); | ||
switch (unit) { | ||
case "year": | ||
return formatDateFunction(new Date(date.setFullYear(date.getFullYear() + amount))); | ||
case "month": | ||
return formatDateFunction(new Date(date.setMonth(date.getMonth() + amount))); | ||
case "hour": | ||
return formatDateFunction(new Date(date.setHours(date.getHours() + amount))); | ||
case "minute": | ||
return formatDateFunction(new Date(date.setMinutes(date.getMinutes() + amount))); | ||
default: | ||
const days = unit == "week" ? amount * 7 : amount; | ||
return formatDateFunction(new Date(date.setDate(date.getDate() + days))); | ||
} | ||
|
||
const days = unit == "week" ? amount * 7 : amount; | ||
return formatDateFunction(new Date(date.setDate(date.getDate() + days))); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
:root{--x7lk6cs:calc(var(--spacing-Full) + var(--spacing-Half));--x57jsby:var(--spacing-Full);--xuudaiz:var(--spacing-Half);--xgx6g7s:var(--spacing-Quarter);--xw3bz76:2px;--xpxh7pw:var(--spacing-GoldenUnit);} | ||
:root{--xlsgbtb:var(--colors-PrimaryBlue);--x1ycuuv6:var(--colors-PrimaryBlueHover);--x4ya1z1:var(--colors-ContrastNeutral);--x10qzjlw:var(--colors-Warn);--x1f4qrrq:var(--colors-Error);} | ||
.xiplo1c:not(#\#){border-radius:var(--xw3bz76)} | ||
.xnfjsdl:not(#\#){gap:var(--xuudaiz)} | ||
.xqu7kxq:not(#\#):not(#\#){box-shadow:0 0 0 2px var(--x10qzjlw)} | ||
.x1h6gzvc:not(#\#):not(#\#){cursor:not-allowed} | ||
.x78zum5:not(#\#):not(#\#){display:flex} | ||
.xdt5ytf:not(#\#):not(#\#){flex-direction:column} | ||
.x190dgpg:not(#\#):not(#\#){opacity:.65} | ||
.x1g8rrie:where(*) *:not(#\#):not(#\#){pointer-events:none} | ||
:root, .newsletter-9l29yl{--newsletter-nggdi0:var(--colors-PrimaryBlue);--newsletter-ntv7pa:var(--colors-PrimaryBlueHover);--newsletter-ebdxud:var(--colors-ContrastNeutral);--newsletter-1r28ar4:var(--colors-Warn);--newsletter-1e13dgl:var(--colors-Error);} | ||
:root, .newsletter-144dbq5{--newsletter-qvrapq:calc(var(--spacing-Full) + var(--spacing-Half));--newsletter-hccsrz:var(--spacing-Full);--newsletter-acnsx1:var(--spacing-Half);--newsletter-14xmwp5:var(--spacing-Quarter);--newsletter-dg5z33:2px;--newsletter-1x7d55:var(--spacing-GoldenUnit);} | ||
.newsletter-b1fjnu:not(#\#){border-radius:var(--newsletter-dg5z33)} | ||
.newsletter-2arzkr:not(#\#){gap:var(--newsletter-acnsx1)} | ||
.newsletter-ifc5da:not(#\#):not(#\#){box-shadow:0 0 0 2px var(--newsletter-1r28ar4)} | ||
.newsletter-1h6gzvc:not(#\#):not(#\#){cursor:not-allowed} | ||
.newsletter-78zum5:not(#\#):not(#\#){display:flex} | ||
.newsletter-dt5ytf:not(#\#):not(#\#){flex-direction:column} | ||
.newsletter-190dgpg:not(#\#):not(#\#){opacity:.65} | ||
.newsletter-1g8rrie:where(*) *:not(#\#):not(#\#){pointer-events:none} |
Oops, something went wrong.