@vipinnagar8700/react-native-date-format
v1.0.4
Published
A lightweight React Native utility for converting any date format into custom readable formats like DD-MM-YYYY, YY/MM/DD hh:mm:ss A (AM/PM), and more. Simple, fast, and dependency-free date formatter for mobile apps.
Downloads
233
Maintainers
Readme
# 📦 @vipinnagar8700/react-native-date-format
A lightweight and dependency-free **React Native date formatter** that converts dates into clean, readable formats — including **DD-MM-YYYY**, **YY/MM/DD**, **hh:mm:ss**, **AM/PM**, and custom patterns.
Perfect alternative to heavy libraries like `moment.js` or `date-fns` when you only need date formatting.
---
## 🚀 Features
- Lightweight — no dependencies
- Supports custom date patterns
- 12-hour & 24-hour mode
- AM/PM formatting
- Works in React Native & JavaScript
- Easy to use
---
## 📥 Installation
```sh
npm install @vipinnagar8700/react-native-date-formator
yarn add @vipinnagar8700/react-native-date-format📌 Usage Example
import { formatDate } from "@vipinnagar8700/react-native-date-format";
const now = new Date();
console.log(formatDate(now, "DD-MM-YYYY")); // Output: 21-11-2025
console.log(formatDate(now, "YYYY/MM/DD")); // Output: 2025/11/21
console.log(formatDate(now, "DD/MM/YY hh:mm A")); // Output: 21/11/25 07:20 PM
console.log(formatDate(now, "hh:mm:ss A")); // Output: 07:20:45 PM📑 Supported Format Tokens
| Token | Meaning | Example |
| ------ | --------------------- | ------- |
| DD | Day (2-digit) | 07 |
| D | Day (1-2 digit) | 7 |
| MM | Month (2-digit) | 04 |
| M | Month (1-2 digit) | 4 |
| YYYY | Full year | 2025 |
| YY | Short year | 25 |
| hh | Hour (12-hour format) | 08 |
| HH | Hour (24-hour format) | 20 |
| mm | Minutes | 05 |
| ss | Seconds | 09 |
| A | AM / PM | PM |
🧪 Example Output
| Format | Output Example |
| -------------------- | --------------------- |
| DD-MM-YYYY | 21-11-2025 |
| YYYY/MM/DD hh:mm A | 2025/11/21 07:20 PM |
| HH:mm:ss | 19:25:45 |
📚 Why Use This?
Most formatting libraries are huge (50-200KB). This package is:
- 🔹 < 3KB
- 🔹 Zero dependencies
- 🔹 Made specifically for React Native developers
🛠 Future Roadmap
- ⏳
time agoformatting (e.g., 5 min ago, yesterday) - 🌍 Locale support
- 🎯 TypeScript types
- 📅 Relative calendar support
👨💻 Author
Mr. Vipin Nagar
📄 License
MIT — free to use in commercial and personal projects.
⭐ Support the Project
If you like this package, please give it a star on GitHub and rate it on npm 🔥
https://github.com/vipinnagar8700/-vipinnagar-react-native-date-format
