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

Header date sometimes off by multiple days #107

Closed
michewl opened this issue Aug 29, 2022 · 2 comments
Closed

Header date sometimes off by multiple days #107

michewl opened this issue Aug 29, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@michewl
Copy link

michewl commented Aug 29, 2022

Describe the bug

The date in the header created for --tag with a config like this {{ timestamp | date(format="%Y-%m-%d") }} (from the detailed.toml) is sometimes off by multiple days.

Adding a timezone or locale does not change the generated date. Using %F as format also generates the wrong date.

It does not seem to be the case for header dates of previous versions, so I believe it is related to the --tag flag.

Timestamp value from context: 1661348531
This should generate 2022-08-29, but will generate 2022-08-24

To Reproduce

Steps to reproduce the behavior:

  1. Generate a changelog that has above template in the config with --tag 1.2.3 for the "unreleased changes".

The full command I use is: git cliff --config .config/cliff.toml --output CHANGELOG.md --tag 1.2.3

Expected behavior

The date should be the correct one for the timestamp in the context (--context).

System (please complete the following information):

  • OS Information: Pop!_OS 22.04 LTS Linux 5.19.0-76051900-generic x86_64 GNU/Linux
  • Git Cliff Version: git-cliff 0.9.0
  • Git Version: git version 2.34.1
@michewl michewl added the bug Something isn't working label Aug 29, 2022
@michewl
Copy link
Author

michewl commented Sep 27, 2022

I think I am mistaken with the timestamp example, but the time still seems to be off when using the --tag flag (git-cliff 0.9.2).

This might be the expected behavior, and I am mistaken for what the timestamp does. I would expect when using --tag, that it uses "now".

I think however, that it uses the date from the latest commit?
Can this be configured to use now in case of --tag, but not for the other regular git tags that already exist?

@orhun
Copy link
Owner

orhun commented Dec 19, 2022

I think I am mistaken with the timestamp example, but the time still seems to be off when using the --tag flag (git-cliff 0.9.2).

This might be the expected behavior, and I am mistaken for what the timestamp does. I would expect when using --tag, that it uses "now".

I think however, that it uses the date from the latest commit? Can this be configured to use now in case of --tag, but not for the other regular git tags that already exist?

Good point! I implemented it in e2cd07b

--tag uses now from now on.

@orhun orhun closed this as completed Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants