블로그 Engineering

Keeping Real Dates When Importing CSVs Into Passman

영문 기사. Passman's generic CSV importer turned date columns into 1970 timestamps. The merged fix parses both epoch numbers and date strings.

JavaScriptnextcloud/passmanCSV importdate parsingpassword managers

A parseInt on a date string, replaced with a parser that understands both formats.

짧은 답변

Passman's generic CSV importer parsed date columns such as created and changed with parseInt(), so a date string became a tiny number and every entry ended up dated near January 1970. The fix keeps numeric epoch values, falls back to Date.parse() for date strings, and leaves the field untouched when the value is empty or unparseable. A maintainer then added OTP handling to the same importer. It was merged as PR #878 and closed issue #840.

The problem

Issue #840, on Nextcloud Hub 10, reported that after importing a CSV with the "created" and "changed" fields kept, "Every date was set to 0 (1970-01-01 01:33:43)".

The fix

var parseTimestampToSeconds = function (value) {
    ...
    if (/^[+-]?\d+(\.\d+)?$/.test(rawValue)) {
        return Math.floor(parseFloat(rawValue));
    }
    const parsedDate = Date.parse(rawValue);
    return isNaN(parsedDate) ? null : Math.floor(parsedDate / 1000);
};
...
const seconds = parseTimestampToSeconds(row[k]);
if (seconds !== null) {
    _credential[field] = seconds;
}

By the numbers

  • Repository: nextcloud/passman, 829 stars (Nov 3, 2026), JavaScript, AGPL-3.0
  • Files changed: 1
  • Lines: +87 / -9 (the PR author's commit was +20 / -3; the maintainer's commit was +67 / -6)
  • Commits: 2 (1 from the PR author, 1 from the maintainer)
  • Opened: Aug 21, 2026. Merged: Aug 24, 2026. Time to merge: 2 days, 23 hours
  • Review: approved and merged by the maintainer

How the review went

The maintainer added a commit, "enhance OTP handling in generic CSV importer", approved and merged the PR, and left a note covering this and the related importer PRs: "Thank you very much for the various importer improvements in this and your other pull requests".

FAQ

Where can I read more?

See the pull request and the original issue.

목표

When people migrate, the history matters as much as the secrets. Keeping created and changed dates intact makes an import trustworthy.

루프 실행

프로덕션 신호를 리뷰된 수정으로 바꾸세요.

무료 체험으로 Prilog가 실제 인시던트를 코드 수준 Pull Request로 연결하는 방식을 확인하세요.