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
Add implicit docyear and localyear attributes #1372
Comments
The question to answer is, should we create the docyear / localyear based off of the docdate / localdate attributes, or should we calculate them independently and require them to be set if you are setting the docdate or localdate explicitly? The problem with basing the values off of docdate and localdate is that there is no guarantee that those values are formatted any particular way. As it stands now (in PR #1988), the code calculates docyear and localyear the same way it calculates docdate and localdate, assuming the use of built-in values. If docdate or localdate is overrridden (from the API or CLI), those values do not currently affect docyear or localyear. Instead, docyear and localyear have to be set independently. |
I decided to go ahead and parse docdate and/or localdate if they are specified and in the expected format of %Y-%m-%d. That should minimize confusion. Therefore, it's enough to just use:
But you can also override the |
- derive docyear from docdate if specified - derive localyear from localdate if specified - add docyear and localyear to tests - optimize code
The current year (either in local time or the date the document was modified) is a very typical piece of information needed in a document. Since we already provide *date and *datetime, it makes sense to add *year as well.
Of course, these can be passed into the document explicitly as a workaround.
The text was updated successfully, but these errors were encountered: