Skip to content

Commit 92cb72d

Browse files
committed
chore: convert docs pages to mdx format for starlight
1 parent a0d08b9 commit 92cb72d

3 files changed

Lines changed: 136 additions & 126 deletions

File tree

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
1-
# Installation
1+
---
2+
title: Installation
3+
---
4+
5+
import { Tabs, TabItem } from '@astrojs/starlight/components';
26

37
Get started with date-and-time in your project using your preferred package manager.
48

59
## Package Manager Installation
610

7-
::: code-group
8-
9-
```bash [npm]
11+
<Tabs>
12+
<TabItem label="npm">
13+
```bash
1014
npm install date-and-time
1115
```
12-
13-
```bash [yarn]
16+
</TabItem>
17+
<TabItem label="yarn">
18+
```bash
1419
yarn add date-and-time
1520
```
16-
17-
```bash [pnpm]
21+
</TabItem>
22+
<TabItem label="pnpm">
23+
```bash
1824
pnpm add date-and-time
1925
```
20-
21-
:::
26+
</TabItem>
27+
</Tabs>
2228

2329
## Requirements
2430

@@ -138,7 +144,7 @@ For browser-only projects, you can use date-and-time directly from a CDN:
138144

139145
## Bundle Size
140146

141-
::: tip Tree Shaking Benefits
147+
:::tip[Tree Shaking Benefits]
142148
date-and-time is built with tree-shaking in mind. You only bundle the functions and locales you actually use, resulting in optimal bundle sizes. Modern bundlers like Webpack 5, Rollup, and Vite automatically eliminate unused code, ensuring your application stays lightweight.
143149
:::
144150

docs/index.md

Lines changed: 0 additions & 115 deletions
This file was deleted.

docs/index.mdx

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
title: date-and-time
3+
description: The simplest, most intuitive date and time library
4+
template: splash
5+
hero:
6+
title: date-and-time
7+
tagline: The simplest, most intuitive date and time library. Modern TypeScript library for date manipulation with full ES Modules support.
8+
image:
9+
src: /date-and-time/logo.png
10+
alt: date-and-time
11+
actions:
12+
- text: Get Started
13+
link: /date-and-time/guide/
14+
icon: right-arrow
15+
variant: primary
16+
- text: API Reference
17+
link: /date-and-time/api/
18+
variant: minimal
19+
- text: View on GitHub
20+
link: https://github.com/knowledgecode/date-and-time
21+
icon: external
22+
variant: minimal
23+
---
24+
25+
import { Card, CardGrid, Tabs, TabItem } from '@astrojs/starlight/components';
26+
27+
## Features
28+
29+
<CardGrid>
30+
<Card title="Modern & Fast" icon="rocket">
31+
Written in TypeScript with ES2021 target. Tree-shakable modules for optimal bundle size.
32+
</Card>
33+
<Card title="Internationalization" icon="translate">
34+
Support for 40+ locales and multiple calendar systems. Arabic, Bengali, Myanmar numerals.
35+
</Card>
36+
<Card title="Timezone Support" icon="moon">
37+
Complete timezone handling with IANA timezone database built-in.
38+
</Card>
39+
<Card title="Type Safe" icon="approve-check">
40+
Full TypeScript support with comprehensive type definitions and IntelliSense.
41+
</Card>
42+
<Card title="Tree Shakable" icon="puzzle">
43+
Import only what you need. Optimized for modern bundlers with sideEffects false.
44+
</Card>
45+
<Card title="Plugin System" icon="add-document">
46+
Extensible plugin system allows you to extend formatters and parsers.
47+
</Card>
48+
</CardGrid>
49+
50+
## Quick Example
51+
52+
```typescript
53+
import { format, parse, addDays } from 'date-and-time';
54+
import ja from 'date-and-time/locales/ja';
55+
56+
const now = new Date();
57+
58+
// Basic formatting
59+
format(now, 'YYYY/MM/DD HH:mm:ss');
60+
// => 2025/08/23 14:30:45
61+
62+
// Localized formatting
63+
format(now, 'YYYY年M月D日(ddd)', { locale: ja });
64+
// => 2025年8月23日(金)
65+
66+
// Timezone-aware formatting
67+
format(now, 'YYYY-MM-DD HH:mm:ss [EST]', { timeZone: 'America/New_York' });
68+
// => 2025-08-23 09:30:45 EST
69+
70+
// Parsing
71+
const date = parse('2025/08/23 14:30:45', 'YYYY/MM/DD HH:mm:ss');
72+
console.log(date)
73+
74+
// Date arithmetic
75+
const futureDate = addDays(now, 7);
76+
console.log(format(futureDate, 'YYYY/MM/DD'));
77+
```
78+
79+
## Key Features in v4.x
80+
81+
- **Complete TypeScript rewrite** with enhanced type safety
82+
- **Tree-shaking support** for better bundle optimization
83+
- **Integrated timezone and timespan plugins** into the core library
84+
- **Modern JavaScript** targeting ES2021 (Node.js ≥18 required)
85+
- **Enhanced API** with options objects instead of boolean flags
86+
- **Improved locale handling** with per-function locale specification
87+
88+
## Browser & Environment Support
89+
90+
- **Node.js**: 18+
91+
- **Browsers**: Chrome 85+, Firefox 78+, Safari 14+, Edge 85+
92+
- **Module Systems**: ES Modules, CommonJS
93+
- **TypeScript**: 4.5+
94+
95+
## Installation
96+
97+
<Tabs>
98+
<TabItem label="npm">
99+
```bash
100+
npm install date-and-time
101+
```
102+
</TabItem>
103+
<TabItem label="yarn">
104+
```bash
105+
yarn add date-and-time
106+
```
107+
</TabItem>
108+
<TabItem label="pnpm">
109+
```bash
110+
pnpm add date-and-time
111+
```
112+
</TabItem>
113+
</Tabs>
114+
115+
## Community
116+
117+
- [GitHub Repository](https://github.com/knowledgecode/date-and-time)
118+
- [npm Package](https://www.npmjs.com/package/date-and-time)
119+
- [Issue Tracker](https://github.com/knowledgecode/date-and-time/issues)

0 commit comments

Comments
 (0)