https://github.com/laclys/dayjs-jp-calendar
day.js plugin for Wareki(Japanese Calendar) 向け和暦
https://github.com/laclys/dayjs-jp-calendar
dayjs dayjs-plugin
Last synced: about 1 month ago
JSON representation
day.js plugin for Wareki(Japanese Calendar) 向け和暦
- Host: GitHub
- URL: https://github.com/laclys/dayjs-jp-calendar
- Owner: laclys
- License: mit
- Created: 2024-03-05T14:57:05.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-01-15T07:38:50.000Z (over 1 year ago)
- Last Synced: 2025-10-07T05:45:25.976Z (8 months ago)
- Topics: dayjs, dayjs-plugin
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/dayjs-jp-calendar
- Size: 148 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE.txt
- Security: SECURITY.md
Awesome Lists containing this project
README
## dayjs-jp-calendar

[](https://www.npmjs.com/package/dayjs-jp-calendar)

> Jpanese Calendar Plugin for Day.js
### Installation
```bash
npm i dayjs-jp-calendar --save
# OR
pnpm i dayjs-jp-calendar
```
### Usage
```typescript
import dayjs from 'dayjs'
import jpCalendar from 'dayjs-jp-calendar'
// OR
import { jpCalendar } from 'dayjs-jp-calendar'
dayjs.extend(jpCalendar)
const date = '2023-11-13'
dayjs(date).format('RRRR') // --> 令和5
dayjs(date).format('RRR') // --> 令和
dayjs(date).format('RR') // --> R5
dayjs(date).format('R') // --> R
dayjs(date).format('rr') // --> ㋿5
dayjs(date).format('r') // --> ㋿
dayjs(date).format('YYYY(RR)/MM/DD') // --> 2023(R5)/11/13
dayjs(date).format('YYYY(rr)/MM/DD') // --> 2023(㋿5)/11/13
```
### Test Coverage
```
% Coverage report from v8
----------|---------|----------|---------|---------|
File | % Stmts | % Branch | % Funcs | % Lines |
----------|---------|----------|---------|---------|
All files | 92.3 | 85.71 | 100 | 92.3 |
index.ts | 92.3 | 85.71 | 100 | 92.3 |
----------|---------|----------|---------|---------|
```
### For Dev
```bash
#Install
pnpm i
#Test
pnpm run test
#Build
pnpm run build
```
### Example case
> [Link](https://github.com/laclys/dayjs-jp-calendar/tree/master/demo)