Skip to content

Bug: Timeline in html-report shows "Invalid Date" #201

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

Open
bodograumann opened this issue Apr 15, 2025 · 10 comments
Open

Bug: Timeline in html-report shows "Invalid Date" #201

bodograumann opened this issue Apr 15, 2025 · 10 comments

Comments

@bodograumann
Copy link

When looking a a single commit in the html report, I see the date at the top left: 07 Apr 2025 10:10:40 CEST.
In the timeline window however, I only see Invalid Date over every commit.

My LANG is en_US.UTF-8. Any other information that might be useful?

@jdespatis
Copy link

I have also the same problem in the html report

For your information, when I trigger a simple report (not an html report), I get this result with "changeReport": null

{
  "gitRepoPath": "/Users/user/Projects/foobar",
  "gitFilePath": "apps/name/openapi.yaml",
  "filename": "openapi.yaml",
  "dateGenerated": "2025-04-29T08:39:37+02:00",
  "reports": [
    {
      "reportSummary": {
        "paths": {
          "totalChanges": 1,
          "breakingChanges": 0
        }
      },
      "changes": [
        {
          "breaking": false,
          "change": 3,
          "changeHash": "FE28eVXDAjzr4UzHw95YdKCK2QOIhJK85U8dq2cQ5oQ=",
          "changeText": "object_added",
          "context": {
            "newColumn": 3,
            "newLine": 710
          },
          "new": "/flow/foobar",
          "original": "",
          "property": "path"
        }
      ],
      "commitDetails": {
        "commitHash": "33cf524",
        "message": "feat(): add new route for test",
        "author": "Username",
        "authorEmail": "[email protected]",
        "committed": "2025-04-29T08:31:17+02:00",
        "changeReport": null
      }
    }
  ]
}

and a git log gives the following date Date: Tue Apr 29 08:31:17 2025 +0200

Is there any other information I can provide to help you find the problem?

Thanks for this wonderful tool!

@daveshanley
Copy link
Member

Could you provide a screen shot? I cannot replicate this locally. this is what I see

Image
Image

@daveshanley
Copy link
Member

also, I will fix the changeReport thing, it's a glitch and should not be there.

@jdespatis
Copy link

Hi @daveshanley , here are the screenshots.
The problem seems to come from message in commit

Image Image

Another thing, when I trigger the command :
openapi-changes html-report --limit-time 30 ./ apps/exporter-full/openapi.yaml
it only considers my last 3 commits, but I have more commits on that openapi.yaml file in the last 30 days, but I guess the problem is the same as above, with the difficulty to get the date from some commits (that contain some specific message with some specific characters, like ( or . maybe that can break your regex)

As problem may come from commit message, here it is in text for easy copy for testing on your side :

commit d3b3d0573b586b005a111966645326b87ecb3f77
Author: semantic-release-bot <[email protected]>
Date:   Wed May 14 15:02:39 2025 +0000

    chore(release): version 1.17.0

    # [1.17.0](https://gitlab.com/../project/compare/1.16.0...1.17.0) (2025-05-14)

    ### Bug Fixes

    * **RET-31142:** Change meta.version from string to number datatype ([147704e](https://gitlab.com/../project/commit/147704e22845bbbbf5cca0413848076c79443cf2))
    * **RET-31142:** Fix consumptionTimes when dto is invalid ([b3e8cd0](https://gitlab.com/../project/commit/b3e8cd0d046c5dd17aae8432dd8aea26a510fd1a))

    ### Features

    * **RET-31142:** Add all flow dtos to OpenAPI spec ([3dceddf](https://gitlab.com/../project/commit/3dceddf1d3f7fa91200ed09a6405849ba7a4a8d9))

commit 147704e22845bbbbf5cca0413848076c79443cf2
Author: Jerome Despatis <[email protected]>
Date:   Wed May 14 11:57:23 2025 +0200

    fix(RET-31142): Change meta.version from string to number datatype

commit 282b29c71f364f704d1aba80154fbbadc939b3fb
Author: Jerome Despatis <[email protected]>
Date:   Fri May 9 17:19:30 2025 +0200

    feat(RET-31142): Add missing attributes in meta to be 100% spec compliant

@daveshanley
Copy link
Member

This is a strange bug man. Why would one date work, and another not, even when formatted with the same RFC.

@jdespatis
Copy link

Yes strange indeed.
I can provide any other information @daveshanley
I'm connected on Discord also if it helps

daveshanley added a commit that referenced this issue May 20, 2025
Trying to debug #201

The date parsing is handled by a “parse anything’ lib, which is great, but also confusing as there should never be an invalid date. When trying to re-run this command locally.  The ‘||’ delimiter was being interpreted as ‘or’ instead of a format string. I changed the delimiter and upgraded it to a quoted string.

Lets see if this solves it.
@daveshanley
Copy link
Member

Can you try this branch? https://github.com/pb33f/openapi-changes/tree/v0.0.80

I am trying to track this glitch down, I think this may be the root of it, I can't re-create it locally.

@jdespatis
Copy link

Yes, I guess you've found the rootcause !

I've performed a test on the 0.0.79 branch, I get that, 2 dates are invalid:

Image

Then I try on the 0.0.80 branch, and I get that result, all dates are valid (except that's a dummy date, but I guess it's normal at that step of diagnostic):

Image

@jdespatis
Copy link

Well, by curiosity, I've checked the change you've done on the branch
As I can see, it was intended to be a final fix, so the date should have been correct but it's not

Here is a debug session to help you, I may have found something

First of all, I think you should revert 6dd07a1

Because, when adding some println in read_local.go, the lines[k] (used in the piece of code c := strings.Split(lines[k], "|||")) is then encapsulated with double quote and your date parsing get wrong, some examples:

"Wed, 7 May 2025 15:32:40 +0000|||d61f07b|||chore(release): version 1.16.0|||semantic-release-bot|||[email protected]"
"Wed, 7 May 2025 11:29:59 +0200|||8e4e694|||feat(RET-32527): Auto generation of OpenAPI specs for both ECS (searcher / exporter-full)|||Jerome Despatis|||[email protected]"

Then, after this commit reverted, I've tested again with some logs:

-----BEFORE fmt.Println(lines[k])----
Wed, 21 May 2025 12:25:56 +0000||6505da4||chore(release): version 1.18.0||semantic-release-bot||[email protected]
-----AFTER fmt.Println(lines[k])----

-----BEFORE dateparse.ParseAny(c[0])----
Wed, 21 May 2025 12:25:56 +0000
2025-05-21 12:25:56 +0000 +0000
-----AFTER dateparse.ParseAny(c[0])------

-----BEFORE fmt.Println(lines[k])----
Wed, 14 May 2025 15:02:39 +0000||d3b3d05||chore(release): version 1.17.0||semantic-release-bot||[email protected]
-----AFTER fmt.Println(lines[k])----

-----BEFORE dateparse.ParseAny(c[0])----
Wed, 14 May 2025 15:02:39 +0000
2025-05-14 15:02:39 +0000 +0000
-----AFTER dateparse.ParseAny(c[0])------
▀  extacted commit 'd3b3d05'
-----BEFORE fmt.Println(lines[k])----
Tue, 13 May 2025 16:10:47 +0200||4d598c4||feat(RET-32539): Prioritize matching by sku over styleCode when both are provided||Ines||ines@zz
-----AFTER fmt.Println(lines[k])----

-----BEFORE dateparse.ParseAny(c[0])----
Tue, 13 May 2025 16:10:47 +0200
2025-05-13 16:10:47 +0200 CEST
-----AFTER dateparse.ParseAny(c[0])------

-----BEFORE fmt.Println(lines[k])----
Wed, 7 May 2025 15:32:40 +0000||d61f07b||chore(release): version 1.16.0||semantic-release-bot||[email protected]
-----AFTER fmt.Println(lines[k])----

-----BEFORE dateparse.ParseAny(c[0])----
Wed, 7 May 2025 15:32:40 +0000
2025-05-07 15:32:40 +0000 +0000
-----AFTER dateparse.ParseAny(c[0])------
▀  extacted commit 'd61f07b'
-----BEFORE fmt.Println(lines[k])----
Wed, 7 May 2025 11:29:59 +0200||8e4e694||feat(RET-32527): Auto generation of OpenAPI specs for both ECS (searcher / exporter-full)||Jerome Despatis||[email protected]
-----AFTER fmt.Println(lines[k])----

-----BEFORE dateparse.ParseAny(c[0])----
Wed, 7 May 2025 11:29:59 +0200
2025-05-07 11:29:59 +0200 CEST
-----AFTER dateparse.ParseAny(c[0])------

-----BEFORE fmt.Println(lines[k])----

-----AFTER fmt.Println(lines[k])----

As you can see, in my case, here are the conversions performed, and how it appears on the html report:

Git date => After parsing On html report
Wed, 21 May 2025 12:25:56 +0000 => 2025-05-21 12:25:56 +0000 +0000 21/05/2025 14:25:56
Wed, 14 May 2025 15:02:39 +0000 => 2025-05-14 15:02:39 +0000 +0000 14/05/2025 17:02:39
Tue, 13 May 2025 16:10:47 +0200 => 2025-05-13 16:10:47 +0200 CEST Invalid Date
Wed, 7 May 2025 15:32:40 +0000 => 2025-05-07 15:32:40 +0000 +0000 07/05/2025 17:32:40
Wed, 7 May 2025 11:29:59 +0200 => 2025-05-07 11:29:59 +0200 CEST Invalid Date

As you can see, the date after parsing is some kind of weird, the timezone appears twice,
However, when looking at that lib you're using (github.com/araddon/dateparse), this behavior seems expected as you can see on their DateParse CLI tester : https://github.com/araddon/dateparse/tree/master/dateparse, with a difference though, +0000 +0000 instead of +0000 UTC

As a result when the timezone is utc (for example 2025-05-21 12:25:56 +0000 +0000), it appears correctly on the report
and for a commit in my timezone (for example 2025-05-13 16:10:47 +0200 CEST), then I always get an Invalid date in the report

I cannot help much more because go is not at all in my stack (in all languages I've been using, the timezone only appears one single time :) )

I can do other tests of course

Hope this helps

@Fab1n
Copy link

Fab1n commented Jun 4, 2025

I have kind of the same issue I think.

I don't know if it helps, but I am sitting in Germany, @jdespatis seems to sit in France, so there might be an issue with non-US citizens?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants