LivelyKernel / LivelyKernel/js-git-browser
invalid date issue with github mixin
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
When invoking `repo.saveAs` for a new commit using the github mixin, the `date` value handed to the `author` object (and supplied to `encodePerson` and ultimately `encodeDate` in jsgit.js) is expected to be an object with fields like "offset" and "seconds", but is actually a Javascript Date object. This causes "invalid date" errors to be thrown by `encodeDate` and prevents commits from being written to GitHub.
I've "fixed" this for my own GitHub-centric use-case by simply hacking `encodePerson` to use the Date object's `toISOString()`, bypassing `encodeDate` -- see the small change in my fork here:
https://github.com/musicog/js-git-browser/blob/fix-date-issue/jsgit.js#L10005
However I appreciate this might well break non-GitHub-centric use-cases. Perhaps you have an idea of how to fix this properly?
Many thanks for the helpful module!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in jsgit.js at repo.saveAs and trace the GitHub mixin's author date through encodePerson to encodeDate. Compare the JavaScript Date value with the date shape expected by encodeDate, then verify that a fix allows GitHub commits to be written without breaking other date inputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, github, javascript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100