Is there a way to set the date format used?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there a way to set the date format used?

wimdeblauwe
I would like to be able to set a date format for the footer (which currently displays as "Last updated 2015-01-29 12:35:40 CET") and also set the date format for built-in attribute "{localdate}". Is there a way to do this? I am using the Maven plugin to generate the html if that matters.
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to set the date format used?

mojavelinux
Administrator
It's possible to change the date by forcefully setting the docdatetime attribute in the Maven configuration (or, outside of Maven, by passing the attribute to the asciidoctor command or API)

The date format is currently hard coded if the docdatetime attribute is not explicitly specified {1}. Modifying the format was not considered in the original requirements (since it wasn't in AsciiDoc Python).

We've grown up now and it's probably time to get serious about handling these dates correctly. We should provide proper parsing of dates and a way to specify the date format used when assigning the implicit values.

-Dan

:1: https://github.com/asciidoctor/asciidoctor/blob/master/lib/asciidoctor/document.rb#L393

On Thu, Jan 29, 2015 at 4:41 AM, wimdeblauwe [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I would like to be able to set a date format for the footer (which currently displays as "Last updated 2015-01-29 12:35:40 CET") and also set the date format for built-in attribute "{localdate}". Is there a way to do this? I am using the Maven plugin to generate the html if that matters.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Is-there-a-way-to-set-the-date-format-used-tp2735.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to set the date format used?

abelsromero
Sort of related question to 'datetime'.

If 'datetime' works and I see many others in the linked code... Does that mean that the rest of parameters explained here http://asciidoc.org/userguide.html#X60 do work?

I always get confused about ruby/python/Js implementations.
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to set the date format used?

wimdeblauwe
In reply to this post by mojavelinux
"It's possible to change the date by forcefully setting the docdatetime attribute in the Maven configuration (or, outside of Maven, by passing the attribute to the asciidoctor command or API)"

Does this mean I have to hardcode the date in my Maven pom? Or would there be a way to format it properly from the current date there?
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to set the date format used?

mojavelinux
Administrator
> Does this mean I have to hardcode the date in my Maven pom? Or would there be a way to format it properly from the current date there?

You can use a Maven variables reference to make it dynamic. There are lots of approaches to how to get the variable set in Maven. Then you do something like:

<docdatetime>${docdatetime}</docdatetime>

Obviously, this is a bit forced, so consider this a workaround for the ultimate goal of custom formatting the date is possible :)

-Dan

On Mon, Feb 2, 2015 at 12:33 AM, wimdeblauwe [via Asciidoctor :: Discussion] <[hidden email]> wrote:
"It's possible to change the date by forcefully setting the docdatetime attribute in the Maven configuration (or, outside of Maven, by passing the attribute to the asciidoctor command or API)"

Does this mean I have to hardcode the date in my Maven pom? Or would there be a way to format it properly from the current date there?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Is-there-a-way-to-set-the-date-format-used-tp2735p2749.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to set the date format used?

mojavelinux
Administrator
In reply to this post by abelsromero

On Mon, Feb 2, 2015 at 12:33 AM, abelsromero [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I always get confused about ruby/python/Js implementations.

Ultimately, the Asciidoctor user guide should cover everything you need to know. We're inching our way there.

http://asciidoctor.org/docs/user-manual/#asciidoctor-vs-asciidoc

(That table definitely needs to be refined and focused. Currently it reads more like a laundry list :))

The Ruby and JavaScript implementations should be exactly the same (if not, we treat it like a bug).

-Dan
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to set the date format used?

wimdeblauwe
In reply to this post by mojavelinux
Seems this Maven plugin can give a formatted date: http://mojo.codehaus.org/build-helper-maven-plugin/timestamp-property-mojo.html