Skip to content

Commit

Permalink
fix: update UTC plugin type file for strict parsing (#1443)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasHFS authored May 26, 2021
1 parent aa5b524 commit b4f28df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
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
}

0 comments on commit b4f28df

Please sign in to comment.