Skip to content

Commit becc926

Browse files
committed
Add VitePress documentation site setup
- Add VitePress configuration and theme setup - Add main documentation home page with feature highlights - Add logo and public assets
1 parent 6ba312d commit becc926

3 files changed

Lines changed: 206 additions & 0 deletions

File tree

docs/.vitepress/config.ts

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import { defineConfig } from 'vitepress';
2+
3+
export default defineConfig({
4+
title: 'date-and-time',
5+
description: 'The simplest, most intuitive date and time library',
6+
base: '/date-and-time/',
7+
ignoreDeadLinks: true,
8+
9+
head: [
10+
['link', { rel: 'icon', href: '/date-and-time/favicon.ico' }]
11+
],
12+
13+
themeConfig: {
14+
logo: '/logo.png',
15+
16+
nav: [
17+
{ text: 'Guide', link: '/guide/' },
18+
{ text: 'API Reference', link: '/api/' },
19+
{ text: 'Locales', link: '/locales' },
20+
{ text: 'Timezones', link: '/timezones' },
21+
{ text: 'Plugins', link: '/plugins' },
22+
{ text: 'Migration', link: '/migration' },
23+
{
24+
text: 'Links',
25+
items: [
26+
{ text: 'GitHub', link: 'https://github.com/knowledgecode/date-and-time' },
27+
{ text: 'npm', link: 'https://www.npmjs.com/package/date-and-time' }
28+
]
29+
}
30+
],
31+
32+
sidebar: {
33+
'/guide/': [
34+
{
35+
text: 'Getting Started',
36+
items: [
37+
{ text: 'Introduction', link: '/guide/' },
38+
{ text: 'Installation', link: '/guide/installation' },
39+
{ text: 'Quick Start', link: '/guide/quick-start' }
40+
]
41+
}
42+
],
43+
'/api/': [
44+
{
45+
text: 'Core Functions',
46+
items: [
47+
{ text: 'Overview', link: '/api/' },
48+
{ text: 'format()', link: '/api/format' },
49+
{ text: 'parse()', link: '/api/parse' },
50+
{ text: 'compile()', link: '/api/compile' },
51+
{ text: 'preparse()', link: '/api/preparse' },
52+
{ text: 'isValid()', link: '/api/isValid' },
53+
{ text: 'transform()', link: '/api/transform' },
54+
{ text: 'addYears()', link: '/api/addYears' },
55+
{ text: 'addMonths()', link: '/api/addMonths' },
56+
{ text: 'addDays()', link: '/api/addDays' },
57+
{ text: 'addHours()', link: '/api/addHours' },
58+
{ text: 'addMinutes()', link: '/api/addMinutes' },
59+
{ text: 'addSeconds()', link: '/api/addSeconds' },
60+
{ text: 'addMilliseconds()', link: '/api/addMilliseconds' },
61+
{ text: 'subtract()', link: '/api/subtract' },
62+
{ text: 'isLeapYear()', link: '/api/isLeapYear' },
63+
{ text: 'isSameDay()', link: '/api/isSameDay' },
64+
]
65+
}
66+
]
67+
},
68+
69+
socialLinks: [
70+
{ icon: 'github', link: 'https://github.com/knowledgecode/date-and-time' }
71+
],
72+
73+
footer: {
74+
message: 'Released under the MIT License.',
75+
copyright: 'Copyright © 2015 KNOWLEDGECODE'
76+
},
77+
78+
search: {
79+
provider: 'local'
80+
}
81+
},
82+
83+
markdown: {
84+
theme: {
85+
light: 'github-light',
86+
dark: 'github-dark'
87+
},
88+
lineNumbers: true
89+
}
90+
})

docs/index.md

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

docs/public/logo.png

152 KB
Loading

0 commit comments

Comments
 (0)