You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`language`|`Locale`\|`LanguageDefinition`| The language to use for parsing and formatting, if your preferred isn't supported, you can directly pass a language definition. |`en`|
77
-
|`formatOptions`|`FormatOptions`| The options to use for formatting. | see below |
78
-
|`parseOptions`|`ParseOptions`| The options to use for parsing. | see below |
|`language`|`Locale`\|`LanguageDefinition`| The language to use for parsing and formatting, if your preferred isn't supported, you can directly pass a language definition. |`en`|
77
+
|`formatOptions`|`FormatOptions`\|`FormatOptionsPreset`| The options to use for formatting. | see below |
79
78
80
79
### Formatting Milliseconds to Duration
81
80
82
-
The `ms` function allows you to format a number of milliseconds to a duration string. Passing a number of milliseconds will return a duration string, if the number is invalid, it will return `null`.
81
+
The `ms` function allows you to format a number of milliseconds to a duration string. Passing a number of milliseconds will return a duration string, if the number is invalid, it will return `null`. The milliseconds overloads also allows you to pass a `FormatOptions` object or a `FormatOptionsPreset` to customise the formatting.
83
82
84
83
```ts
85
-
function ms(milliseconds:number, options?:FormatOptions):string|null;
84
+
function ms(milliseconds:number):string|null;
85
+
function ms(milliseconds:number, options:FormatOptions):string|null;
86
+
function ms(milliseconds:number, preset:FormatOptionsPreset):string|null;
The `ms` function also allows you to parse a duration string (`1 day`, `3 weeks 4 days`, etc). Passing a duration string will return a number of milliseconds, if no valid duration units are found, it will return `0`.
102
111
103
112
```ts
104
-
function ms(duration:string, options?:ParseOptions):number;
0 commit comments