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

purgeTime display #557

Closed
natilou opened this issue May 18, 2023 · 2 comments · Fixed by #558
Closed

purgeTime display #557

natilou opened this issue May 18, 2023 · 2 comments · Fixed by #558

Comments

@natilou
Copy link
Contributor

natilou commented May 18, 2023

Currently the purge time is displayed with the format hours, minutes, seconds. For example, I want to store the files for 30 days, but in the web page shows "Files stored for 720h0m0s":
Screenshot from 2023-05-17 23-39-47

I have thought of two different approaches:

1. Display only the days without the hours and seconds:
Screenshot from 2023-05-17 23-37-52

2. Display the days, hours and seconds, omitting zero values:
Screenshot from 2023-05-17 23-35-13

I know that at the moment transfer.sh only supports days (an int value) for the purge time. If this is always going to be the case, perhaps it would be better to only show the days the files will be stored.
But, if there are plans or ideas to use another duration, such as minutes or seconds, in addition to days, the second approach would be better.

I'm willing to work on this, after deciding which approach to take.

@aspacca
Copy link
Collaborator

aspacca commented May 18, 2023

I know that at the moment transfer.sh only supports days (an int value) for the purge time. If this is always going to be the case, perhaps it would be better to only show the days the files will be stored.

yes, I don't plan to change the resolution of purge days to other than (well ...) days :)

the "human redeable" format of the period is https://github.com/dutchcoders/transfer.sh/blob/main/server/handlers.go#L377
Basically calling time.Duration.String(), that was the laziest thing to do. we can change that to a custom formatter to just print X days

@natilou
Copy link
Contributor Author

natilou commented May 18, 2023

yes, I don't plan to change the resolution of purge days to other than (well ...) days :)

the "human redeable" format of the period is https://github.com/dutchcoders/transfer.sh/blob/main/server/handlers.go#L377 Basically calling time.Duration.String(), that was the laziest thing to do. we can change that to a custom formatter to just print X days

Great, I will change it to print X days. Thanks!

natilou added a commit to natilou/transfer.sh that referenced this issue May 18, 2023
- changing the line `purgeTime = s.purgeDays.String()` to use a function that formats the days like this: "N days" or "1 day"
- adding the function `formatDurationDays` in utils.go file

Fixes dutchcoders#557
aspacca added a commit that referenced this issue May 19, 2023
- changing the line `purgeTime = s.purgeDays.String()` to use a function that formats the days like this: "N days" or "1 day"
- adding the function `formatDurationDays` in utils.go file

Fixes #557

Co-authored-by: Andrea Spacca <andrea.spacca@gmail.com>
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 a pull request may close this issue.

2 participants