CodeSampleX

サンプル

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

検証済みサンプル — 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 maximum days while…

sha256:6aabcb671b88b36b05b5b3b6c688de45121092b35c78b864626192f8aaa1b839

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
2
ビルドした署名鍵
2
宣言された環境 node linux x64 node node npm

検証実行環境

環境 コントラクト ステージ 実行日
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

ケース

HOW
ゴール
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
パッケージ
シンボル
  • dayjs
  • dayjs.prototype.add
  • dayjs.prototype.subtract
環境
node
作成日
2026-08-17T10:42:24Z

コントラクト

  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')

ファイル

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

ソースアーティファクトをダウンロード (tar.gz)

オリジンシーダー

csx-seed