iamkun / iamkun/dayjs

Getting invalid time for partial time

Open
#2,269 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
This works well
```
const ts = "15:00:00"
const timeString = dayjs(ts, 'HH:mm:ss').format('HH:mm:ss');

```
But if
```
const ts = "15:00"
const timeString = dayjs(ts, 'HH:mm:ss').format('HH:mm:ss');

```
This gives invalid date if it doesn't matches with the parse format

**Expected behavior**
It should parse partial string correctly as moment does

**Information**
- Day.js Version [1.11.7]
- OS: [iOS]
- Browser [node: 18]
- Time zone: [GMT +5:30 ]

@iamkun

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.