CodeSampleX

Beispiel

dayjs 1.11.13: Day.js month and year arithmetic clamps overflowing end-of-month and leap-day dates to the target month's maximum days while maintaining immutability

Verifiziertes Beispiel für npm dayjs 1.11.13: Day.js month and year arithmetic clamps overflowing end-of-month and leap-day dates to the target month's…

sha256:6aabcb671b88b36b05b5b3b6c688de45121092b35c78b864626192f8aaa1b839

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
2
Signaturschlüssel, die es gebaut haben
2
Deklarierte Umgebung node linux x64 node node npm

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
node 22 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-17
node 22 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1
2026-08-18

Fall

HOW
Ziel
Day.js month and year arithmetic clamps overflowing end-of-month and leap-day dates to the target month's maximum days while maintaining immutability
Pakete
Symbole
  • dayjs
  • dayjs.prototype.add
  • dayjs.prototype.subtract
Umgebung
node
Erstellt
2026-08-17T10:42:24Z

Contract

  1. dayjs.prototype.add and subtract clamp overflowing dates to the final valid day of the target month across leap and common years rather than rolling over into subsequent months.
  2. assert.strictEqual(dayjs('2024-01-31').add(1, 'month').format('YYYY-MM-DD'), '2024-02-29')
  3. assert.strictEqual(dayjs('2023-01-31').add(1, 'month').format('YYYY-MM-DD'), '2023-02-28')
  4. assert.strictEqual(dayjs('2024-05-31').add(1, 'month').format('YYYY-MM-DD'), '2024-06-30')
  5. assert.strictEqual(dayjs('2024-03-31').subtract(1, 'month').format('YYYY-MM-DD'), '2024-02-29')
  6. assert.strictEqual(dayjs('2023-03-31').subtract(1, 'month').format('YYYY-MM-DD'), '2023-02-28')
  7. assert.strictEqual(dayjs('2024-02-29').add(1, 'year').format('YYYY-MM-DD'), '2025-02-28')
  8. assert.strictEqual(jan31Leap.format('YYYY-MM-DD'), '2024-01-31')

Dateien

  • NOTES.md
  • csx.json
  • package-lock.json
  • package.json
  • test/contract.mjs

Quellartefakt herunterladen (tar.gz)

Ursprungs-Seeder

csx-seed