Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the docs & TS Type File to be able to use strict parsing with UTC plugin #1443

Merged
merged 1 commit into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/en/Plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,16 @@ dayjs
.local()
.format() //2019-03-06T17:11:55+08:00
dayjs.utc('2018-01-01', 'YYYY-MM-DD') // with CustomParseFormat plugin
dayjs.utc('2018-01-01', 'YYYY-MM-DD', true) // with CustomParseFormat plugin & Using strict parsing
```

By default, Day.js parses and displays in local time.

If you want to parse or display in UTC, you can use `dayjs.utc()` instead of `dayjs()`.

#### dayjs.utc `dayjs.utc(dateType?: string | number | Date | Dayjs, format? string)`
You may specify a boolean for the last argument to use `strict parsing`. Strict parsing requires that the format and input match exactly, including delimiters.

#### dayjs.utc `dayjs.utc(dateType?: string | number | Date | Dayjs, format? string, strict?: boolean)`

Returns a `Dayjs` object in UTC mode.

Expand Down
2 changes: 1 addition & 1 deletion types/plugin/utc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ declare module 'dayjs' {
utcOffset(offset: number, keepLocalTime?: boolean): Dayjs
}

export function utc(config?: ConfigType, format?: string): Dayjs
export function utc(config?: ConfigType, format?: string, strict?: boolean): Dayjs
}