iamkun / iamkun/dayjs

moment.js invalidAt() support?

Open
#1,279 1 comment 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

Hi,

Do you have plans to implement moment's invalidAt() in dayjs? Can I maybe get this kind of information from dayjs any other way?

Quote from https://momentjscom.readthedocs.io/en/latest/moment/01-parsing/15-is-valid/

> Additionally, you can use moment#invalidAt to determine which date unit overflowed.
>
> var m = moment("2011-10-10T10:20:90");
> m.isValid(); // false
> m.invalidAt(); // 5 for seconds
>
> The return value has the following meaning:
>
> years
> months
> days
> hours
> minutes
> seconds
> millisecond

Contributor guide

Open the contributing guide

Research direction

Read the issue's Moment.js invalidAt() example alongside Day.js's isValid() behavior, then determine the intended public API and overflow-unit semantics. Done means the scope is settled for reporting the invalid unit or documenting an alternative, with behavior validated for the quoted seconds-overflow case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.