git-release-manager
Version:
A tool to generate release notes from git commit history
20 lines • 815 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatISO8601 = formatISO8601;
exports.formatDateForGit = formatDateForGit;
const date_fns_1 = require("date-fns");
/**
* Converts a date string from the format 'YYYY-MM-DD HH:mm:ss ±HHMM' to ISO 8601 format.
*
* @param dateStr - The date string to be converted, e.g., '2025-01-07 16:57:38 +0300'.
* @returns The date string in ISO 8601 format, e.g., '2025-01-07T16:57:38+03:00'.
*/
function formatISO8601(dateStr) {
const parsedDate = (0, date_fns_1.parse)(dateStr, 'yyyy-MM-dd HH:mm:ss X', new Date());
return (0, date_fns_1.format)(parsedDate, "yyyy-MM-dd'T'HH:mm:ssXXX");
}
function formatDateForGit(dateStr) {
const date = new Date(dateStr);
return date.toISOString();
}
//# sourceMappingURL=date.js.map