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

allow maxAge to be configured with human-readable strings #129

Closed
tacman opened this issue Mar 13, 2024 · 2 comments · Fixed by #135
Closed

allow maxAge to be configured with human-readable strings #129

tacman opened this issue Mar 13, 2024 · 2 comments · Fixed by #135
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@tacman
Copy link
Contributor

tacman commented Mar 13, 2024

Description

Since PHP will parse standard time strings, instead of converting maxAge to something human readable in the debug toolbar, what about putting the human-readable string in the yaml.

Example

pwa:
    serviceworker:
        enabled: true
        src: "sw.js"
        workbox:
            image_cache:
                enabled: true
#                max_age: 2_592_000 # 30 days
                max_age: 30 days
                max_entries: 200
                regex: '/\.(png|jpe?g|svg|webp)$/'
@Spomky
Copy link
Member

Spomky commented Mar 16, 2024

Indeed, that would be nice.
Something like this should be fine:

$now = new \DateTimeImmutable();
$future = $now->add(\DateInterval::createFromDateString('30 day'));
$seconds = abs($future->getTimestamp()-$now->getTimestamp());

@Spomky Spomky self-assigned this Mar 16, 2024
@Spomky Spomky added the enhancement New feature or request label Mar 16, 2024
@Spomky Spomky added this to the 1.1.0 milestone Mar 16, 2024
@Spomky Spomky linked a pull request Mar 17, 2024 that will close this issue
4 tasks
@Spomky Spomky mentioned this issue Mar 17, 2024
4 tasks
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants