Skip to content
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
6 changes: 3 additions & 3 deletions docs/api/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ dates.forEach(date => {
import { compile, format } from 'date-and-time';

class Logger {
private timestampPattern = compile('YYYY-MM-DD HH:mm:ss.SSS');
private timestampPattern = compile('\\[YYYY-MM-DD HH:mm:ss.SSS\\]');

log(level: string, message: string) {
const timestamp = format(new Date(), this.timestampPattern);
console.log(`[${timestamp}] ${level.toUpperCase()}: ${message}`);
console.log(`${timestamp} ${level.toUpperCase()}: ${message}`);
}
}

Expand Down
4 changes: 4 additions & 0 deletions docs/api/format.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ format(date, 'YYYY-MM-DD[T]HH:mm:ss[Z]');

format(date, '[Report generated on] YYYY/MM/DD [at] HH:mm');
// => Report generated on 2025/08/23 at 14:30

// Escape square brackets to output them literally
format(date, '\\[YYYY-MM-DD HH:mm:ss\\]');
// => [2025-08-23 14:30:45]
```

### Complex Localized Formatting
Expand Down
4 changes: 4 additions & 0 deletions docs/api/parse.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,10 @@ parse('2025-08-23T14:30:45Z', 'YYYY-MM-DD[T]HH:mm:ss[Z]');

parse('Report generated on 2025/08/23 at 14:30', '[Report generated on] YYYY/MM/DD [at] HH:mm');
// => Fri Aug 23 2025 14:30:00 GMT+0900

// Escape square brackets to parse them from input string
parse('[2025-08-23 14:30:45]', '\\[YYYY-MM-DD HH:mm:ss\\]');
// => Fri Aug 23 2025 14:30:45 GMT+0900
```

### Wildcard Parsing
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

- **Timezone Support** - Comprehensive timezone data from timezonedb
- **Locale Support** - 40+ languages with native formatting
- **Plugin System** - Extensible with microsecond/nanosecond precision
- **Plugin System** - Extend formatters and parsers
- **Duration Objects** - Rich time difference calculations

## Version 4.x Highlights
Expand Down
9 changes: 6 additions & 3 deletions eslint.config.ts → eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
// @ts-check
import { defineConfig } from 'eslint/config';
import tseslint from 'typescript-eslint';

export default tseslint.config(
...tseslint.configs.strict,
...tseslint.configs.stylistic,
export default defineConfig(
tseslint.configs.strict,
tseslint.configs.stylistic,
{
files: ['**/*.ts'],
languageOptions: {
ecmaVersion: 2021,
sourceType: 'module',
globals: {
process: true
},
parserOptions: {
project: './tsconfig.json',
Expand Down
Loading