chronal 0.0.1-1 → 0.0.1-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -36
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Chronal
|
|
2
2
|
|
|
3
3
|
A tiny, fast, and modern date utility library for JavaScript/TypeScript with zero dependencies.
|
|
4
4
|
|
|
@@ -19,23 +19,23 @@ A tiny, fast, and modern date utility library for JavaScript/TypeScript with zer
|
|
|
19
19
|
### Deno
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
|
-
import { format, add, sub } from "jsr:@your-scope/
|
|
22
|
+
import { format, add, sub } from "jsr:@your-scope/chronal";
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### Node.js / npm
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
npm install
|
|
28
|
+
npm install chronal
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
```javascript
|
|
32
|
-
import { format, add, sub } from "
|
|
32
|
+
import { format, add, sub } from "chronal";
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
## Quick Start
|
|
36
36
|
|
|
37
37
|
```typescript
|
|
38
|
-
import { format, add, sub, startOf, endOf } from "
|
|
38
|
+
import { format, add, sub, startOf, endOf } from "chronal";
|
|
39
39
|
|
|
40
40
|
const date = new Date("2024-06-15T14:35:22Z");
|
|
41
41
|
|
|
@@ -306,17 +306,7 @@ Returns an array of weekday names (Monday to Sunday) for the specified locale.
|
|
|
306
306
|
weekdays("en-US", "long"); // ['Monday', 'Tuesday', ...]
|
|
307
307
|
weekdays("en-US", "short"); // ['Mon', 'Tue', ...]
|
|
308
308
|
weekdays("pt-BR", "long"); // ['segunda-feira', 'terça-feira', ...]
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
## Performance
|
|
312
|
-
|
|
313
|
-
Chrona is optimized for performance, especially in formatting operations:
|
|
314
|
-
|
|
315
|
-
```
|
|
316
|
-
Benchmark: 1,000,000 iterations of format(date, 'YYYY-MM-DD HH:mm:ss')
|
|
317
309
|
|
|
318
|
-
chrona: 254ms
|
|
319
|
-
dayjs: 1540ms (6x slower)
|
|
320
310
|
```
|
|
321
311
|
|
|
322
312
|
Key optimizations:
|
|
@@ -325,25 +315,17 @@ Key optimizations:
|
|
|
325
315
|
- Optimized padding functions
|
|
326
316
|
- Direct string concatenation
|
|
327
317
|
|
|
328
|
-
## Why
|
|
318
|
+
## Why Chronal?
|
|
329
319
|
|
|
330
|
-
|
|
331
|
-
- **6x faster** for formatting operations
|
|
332
|
-
- Zero dependencies (Day.js requires plugins for many features)
|
|
333
|
-
- UTC-first design prevents timezone bugs
|
|
334
|
-
- Modern ES modules
|
|
320
|
+
Chronal offers a modern approach to date manipulation with a focus on simplicity and performance:
|
|
335
321
|
|
|
336
|
-
|
|
337
|
-
-
|
|
338
|
-
-
|
|
339
|
-
-
|
|
340
|
-
-
|
|
322
|
+
- **Performance-focused** - Optimized for common operations like formatting
|
|
323
|
+
- **Zero dependencies** - Built on native JavaScript APIs
|
|
324
|
+
- **UTC-first** - Reduces timezone-related bugs by defaulting to UTC
|
|
325
|
+
- **Lightweight** - Small bundle size, fully tree-shakeable
|
|
326
|
+
- **Modern** - ES modules, TypeScript support, immutable operations
|
|
341
327
|
|
|
342
|
-
|
|
343
|
-
- **Much smaller** (Moment.js is no longer maintained)
|
|
344
|
-
- Immutable by default (no mutation footguns)
|
|
345
|
-
- Tree-shakeable
|
|
346
|
-
- Modern codebase
|
|
328
|
+
Chronal works well alongside other date libraries. Choose the tool that best fits your project's needs.
|
|
347
329
|
|
|
348
330
|
## Design Principles
|
|
349
331
|
|
|
@@ -356,7 +338,7 @@ Key optimizations:
|
|
|
356
338
|
|
|
357
339
|
## Browser Support
|
|
358
340
|
|
|
359
|
-
|
|
341
|
+
Chronal works in all modern browsers and JavaScript runtimes that support:
|
|
360
342
|
- ES6+ features
|
|
361
343
|
- `Intl.DateTimeFormat` API
|
|
362
344
|
- Native Date object
|
|
@@ -367,10 +349,9 @@ Contributions are welcome! Please feel free to submit a Pull Request.
|
|
|
367
349
|
|
|
368
350
|
## License
|
|
369
351
|
|
|
370
|
-
MIT ©
|
|
352
|
+
MIT © André Luiz Gomes Filho
|
|
371
353
|
|
|
372
354
|
## Links
|
|
373
355
|
|
|
374
|
-
- [
|
|
375
|
-
- [
|
|
376
|
-
- [Report Issues](https://github.com/your-username/chrona/issues)
|
|
356
|
+
- [GitHub Repository](https://github.com/andreluizsgf/chronal)
|
|
357
|
+
- [Report Issues](https://github.com/andreluizsgf/chronal/issues)
|