Giter VIP home page Giter VIP logo

Comments (9)

sac-cas avatar sac-cas commented on June 28, 2024 2

Did you solve your problem?

Currently, my CI builds create the date in the header in the following format: mm/dd/yyyy
I don't know why but it seems to be related to the locale settings of the container. On my Mac it is still yyyy-mm-dd.

It would be nice to use a dedicated setting for the format or a hint in the documentation how to handle date format issues.

from release-notes-generator.

ayushnau avatar ayushnau commented on June 28, 2024 1

@peterhirn thanks a lot for your help . This works for me now it is working fine.

from release-notes-generator.

peterhirn avatar peterhirn commented on June 28, 2024

It seems like date can't be configured at all?

The config value https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#date is outside of the writerOpts.

My config currently produces dates formatted like 2024-2-27 🤷

Edit: Found this function called formatDate https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-writer/src/types/options.ts#L116, unfortunately it is never called...

Edit 2: I ended up using pnpm patch conventional-changelog-writer to fix the formatting.

patches/[email protected]

diff --git a/index.js b/index.js
index 86e5add10bf78569c4e886c7ed3f8554acd80109..fb1d6f6034eaa5a207118a6088b11046fd2dabaa 100644
--- a/index.js
+++ b/index.js
@@ -23,7 +23,7 @@ async function conventionalChangelogWriterInit (context, options) {
   context = {
     commit: 'commits',
     issue: 'issues',
-    date: dateFormatter.format(new Date()),
+    date: new Date().toISOString().slice(0, 10),
     ...context
   }

from release-notes-generator.

bilelomrani1 avatar bilelomrani1 commented on June 28, 2024

Hi @sac-cas I did not unfortunately, but I agree that a dedicated setting would be a nice addition.

from release-notes-generator.

ayushnau avatar ayushnau commented on June 28, 2024

Can you tell me if the package is added with the date formatter. thank you.

from release-notes-generator.

peterhirn avatar peterhirn commented on June 28, 2024

With the update of semantic-release to v24 and conventional-changelog-conventionalcommits to v8 the date format function was fixed.

const DATETIME_LENGTH = 10;
/**
 * Formats date to yyyy-mm-dd format.
 * @param date - Date string or Date object.
 * @returns Date string in yyyy-mm-dd format.
 */
export function formatDate(date) {
    return new Date(date).toISOString().slice(0, DATETIME_LENGTH);
}

The default format is now yyyy-mm-dd regardless of the environment. I didn't test if a custom date format function can now be configured too.

from release-notes-generator.

ayushnau avatar ayushnau commented on June 28, 2024

yeah actually I am getting error, regarding the same. As the date recieved here is {} .
image

which is causing the command to get failed. Now I have check my commits date format they are normal. as they should be.
image

The issue I am getting:
image

Can you help me with than what is causing this issue. @peterhirn

from release-notes-generator.

peterhirn avatar peterhirn commented on June 28, 2024

@ayushnau Looks like you are using the previous version of conventional-changelog-writer. I think this is the case because in v8 the file node_modules/conventional-changelog-writer/index.js doesn't exist (everything is in the dist directory).

Check your package.json file and maybe nuke your node_modules and reinstall all dependencies.

  "devDependencies": {
    "@semantic-release/changelog": "6.0.3",
    "@semantic-release/exec": "6.0.3",
    "@semantic-release/git": "10.0.1",
    "@semantic-release/gitlab": "13.1.0",
    "conventional-changelog-conventionalcommits": "8.0.0",
    "semantic-release": "24.0.0",
    ...
  }

from release-notes-generator.

travi avatar travi commented on June 28, 2024

closing since it sounds like this is resolved. please feel free to leave additional comments if that is not the case in other scenarios

from release-notes-generator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.