[Bug]: ISOWEEKNUM returns 53 for late-December dates that belong to week 1 of the next year

オープン 初心者向け
#1,884 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
node.js, typescript
領域
backend, data

調査の方向性

誤った結果の原因として issue が挙げている DateTimePlugin.ts の isoweeknumCore から始めてください。その動作を、ISOWEEKNUM と WEEKNUM(date, 21) について提示された例および期待値と比較してください。12月下旬に列挙された日付が1を返し、1月1日も引き続き1を返すことが完了条件です。

索引モデルが issue の本文から書いたものです。

説明

Description

ISOWEEKNUM returns 53 for 29-31 December when those days are in ISO week 1 of the following year. For example, 31 December 2024 is a Tuesday in ISO week 2025-W01, so the result should be 1. WEEKNUM(date, 21) has the same problem.

const { HyperFormula } = require('hyperformula')

const hf = HyperFormula.buildFromArray([[
  '=ISOWEEKNUM(DATE(2024,12,31))',
  '=ISOWEEKNUM(DATE(2019,12,30))',
  '=ISOWEEKNUM(DATE(2025,12,29))',
  '=WEEKNUM(DATE(2024,12,31),21)',
  '=ISOWEEKNUM(DATE(2025,1,1))',
]], { licenseKey: 'gpl-v3' })

console.log(hf.getSheetValues(0)[0])

Actual: [ 53, 53, 53, 53, 1 ]

Expected (Excel, LibreOffice): [ 1, 1, 1, 1, 1 ]

2019, 2024, and 2025 have only 52 ISO weeks, so week 53 does not exist in those years.

Cause: isoweeknumCore in DateTimePlugin.ts only counts weeks from the first Thursday of the date's own calendar year and never checks whether the date is already in week 1 of the following year.

Excel reference: https://support.microsoft.com/en-us/office/isoweeknum-function-1c2d0afe-d25b-4ab1-8894-8d0520e90e0e

Video or screenshots

N/A

Demo

https://gist.github.com/trackoor/f47a7f14de1d5fbe21bebbf2a36afc22

HyperFormula version

3.5.0 (npm), also develop at 5a6eb09

Your framework

None (Node.js)

Your environment

Node.js 26.13.0 on Linux

Credit: https://ucsbplse.github.io/

主要言語
TypeScript
スター
2.8k
フォーク
175
平均マージ
2日 8時間
マージ済み PR(30日)
21

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

handsontable/hyperformula のほかの issue

handsontable/hyperformula の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。