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
Adds a "never" expiration option #125
Adds a "never" expiration option #125
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
Cool, thanks for taking this on, @viktorpenelski! I prefer this approach to #124 because I'm worried about a case where we forget to check for nil time in something like the garbage collector and we end up deleting all the "Never" expire files because they look like they expired. I think the best approach is to define a var in var NeverExpire = ExpirationTime(time.Date(3000, time.January, 0, 0, 0, 0, 0, time.UTC)) And then use that for the "Never" option. Then we can edit formatExpiration to special-case the Never option like: if et == types.NeverExpire {
return "Never"
} I refactored the expiration option rendering to happen server side (#126) to make this easier. |
Thanks, @mtlynch, the refactor makes it really easy! I've added the Out of curiosity, is there a nicer way to tie a constant variable or a method to a custom type? E.g. instead of having |
LGTM, thanks!
Good question! I don't think this is possible. The closest I can think of is to tie it to a package, the way Golang does with months like It is properly type-checked though. If you try to treat
|
This is a naive way of solving #92 by adding a "never" expire option by setting the data way into the future.