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 month calculation to 30 days, and add no expiry and year as expiry options #49

Merged
merged 6 commits into from
Aug 20, 2024

Conversation

rutvora
Copy link
Contributor

@rutvora rutvora commented Aug 9, 2024

Fixes #47, Resolves #48

@rutvora rutvora closed this Aug 9, 2024
@rutvora rutvora reopened this Aug 9, 2024
@rutvora
Copy link
Contributor Author

rutvora commented Aug 9, 2024

Sorry for closing and re-opening the PR (it was a mis-click)

@rutvora rutvora changed the title Fixes #47, Adds features requested in #48 Fix month calculation to 30 days, and add no expiry and year as expiry options Aug 9, 2024
@SharzyL
Copy link
Owner

SharzyL commented Aug 9, 2024

Seems that you also need to modify the corresponding tests

@rutvora
Copy link
Contributor Author

rutvora commented Aug 19, 2024

Seems that you also need to modify the corresponding tests

Done

@@ -127,7 +127,7 @@ test("expire", async () => {
await testExpireParse("100m", 6000)
await testExpireParse("100h", 360000)
await testExpireParse("1d", 86400)
await testExpireParse("1M", 18144000)
await testExpireParse("1M", 2592000)
await testExpireParse("100 m", 6000)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need tests on Y and empty expiration, considering changes in parseExpiration()

@@ -43,7 +43,7 @@ <h2>Settings</h2>
<div id='paste-expiration-panel' class='paste-setting-subitem-panel'>
<input list='expiration-choices' type='text' min='60' step='1' name='paste-expiration'
id='paste-expiration-input' placeholder='Expiration (secs)' value='7d'>
<label class='small-label' for='paste-expiration-input'>Delete your paste after a period of time. <br>Units: s (seconds), m (minutes), h (hours), d (days), M (months)</label>
<label class='small-label' for='paste-expiration-input'>Delete your paste after a period of time (leave blank for no expiry). <br>Units: s (seconds), m (minutes), h (hours), d (days), M (months), Y (years) <br> Max 68 years</label>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Max 68 years could be omitted since I don't think the service can live so long and I prefer the label to be as concise as possible.

@@ -83,7 +83,10 @@ window.addEventListener('DOMContentLoaded', () => {
const pasteNotEmpty = inputType === 'edit'
? pasteEditArea.prop('value').length > 0
: file !== null
const expirationValid = EXPIRE_REGEX.test(expiration) // TODO: verify it
expirationValid = EXPIRE_REGEX.test(expiration) // TODO: verify it
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use let, no implicit declaration

Add tests for expiration in years and no expiry
@SharzyL SharzyL merged commit b6e0f6e into SharzyL:goshujin Aug 20, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Allow no expiry and specifying expiry in years A month is not 30 weeks (LOL)
2 participants