Skip to content

Option to control format of date-output #472

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

Closed
christophhalbi opened this issue Mar 15, 2022 · 15 comments
Closed

Option to control format of date-output #472

christophhalbi opened this issue Mar 15, 2022 · 15 comments
Assignees
Labels
enhancement New feature or request platform issue Issue is specific to an OS or desktop priority-low
Milestone

Comments

@christophhalbi
Copy link

Hi,

Is there any option to control the format of the date-output in header/footer?

@michaelrsweet michaelrsweet self-assigned this Mar 15, 2022
@michaelrsweet michaelrsweet added the question General usage question label Mar 15, 2022
@michaelrsweet
Copy link
Owner

No, HTMLDOC just uses the date format from the current locale. What are you trying to do?

@christophhalbi
Copy link
Author

I run htmldoc from the perl-world via open3 and looking for a way to get the correct locale into the header via --header=D..

@michaelrsweet
Copy link
Owner

Are you basing it on the server's locale, or do you want it to match the web browser language (Accept-Language header)?

@christophhalbi
Copy link
Author

On the server's locale

@michaelrsweet
Copy link
Owner

OK, well it should be picking it up already. What are the values of the LANG and LC_xxx environment variables?

@christophhalbi
Copy link
Author

LANG=en_US.UTF-8
LC_ALL isn't set

I tried

LC_ALL=de_DE.utf8 htmldoc --quiet --webpage -t pdf --jpeg --no-link --header D.. --footer D./ --outfile foo.pdf foo.html

But it didn't change anything

@michaelrsweet michaelrsweet added bug Something isn't working platform issue Issue is specific to an OS or desktop priority-low and removed question General usage question labels Mar 15, 2022
@michaelrsweet michaelrsweet added this to the Stable milestone Mar 15, 2022
@michaelrsweet
Copy link
Owner

OK, take a deeper look into this - it should be picking up the locale for the date/time format. What OS/Linux distribution are you using?

@christophhalbi
Copy link
Author

Thank you

NAME="openSUSE Leap"
VERSION="15.3"

@christophhalbi
Copy link
Author

htmldoc --version
1.9.12

@michaelrsweet
Copy link
Owner

Try:

LC_TIME="de_DE.UTF-8" htmldoc ...

@christophhalbi
Copy link
Author

Hi,

No, doesn't work.

@christophhalbi
Copy link
Author

What's interesting: without LC_ALL or LC_TIME I get something like 03/22/2022 05:56:29 AM. When I use LC_ALL I get 22.03.2022 05:57:32.
So it actually does something.

@michaelrsweet michaelrsweet added enhancement New feature or request and removed bug Something isn't working labels Mar 22, 2022
@michaelrsweet
Copy link
Owner

Right, I'm not sure if there is a way to customize the date format for a particular locale (I think you need to edit the glibc sources), so right now the best you can do is find a locale that formats the date and time the way you like and set LC_TIME accordingly.

@michaelrsweet
Copy link
Owner

OK, I've updated HTMLDOC to support date/time format strings so you can customize things:

[master a67e9cc] Add support for "$DATE(format)" and "$TIME(format)" header/footer strings (Issue #472)

This will be part of the upcoming HTMLDOC 1.9.16 release.

@christophhalbi
Copy link
Author

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request platform issue Issue is specific to an OS or desktop priority-low
Projects
None yet
Development

No branches or pull requests

2 participants