denoland / denoland/std

datetime/parse: cannot parse ISO week date

Open
#3,928 7 comments 1 reaction 0 assignees View on GitHub
enhancement help wanted
Dominant language
TypeScript
Stars
3.6k
Forks
681
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

parse() cannot parse [ISO week date](https://en.wikipedia.org/wiki/ISO_week_date) such as `2023-W50`.

**Steps to Reproduce**

```ts
import { parse } from "https://deno.land/std@0.208.0/datetime/parse.ts"

parse("2023-W50", "yyyy-MM-dd")
```

**Expected behavior**

it returns `2023-12-11`. however, it errors with

```
Uncaught Error: value not valid for token { month undefined } W20
at DateTimeFormatter.parseToParts (https://deno.land/std@0.208.0/datetime/_common.ts:562:15)
at parse (https://deno.land/std@0.208.0/datetime/parse.ts:28:27)
at :1:22

```

**Environment**

- OS: Ubuntu 23.10
- deno version: 1.38.5+e9ab9ba canary
- std version: 0.208.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.