# BuddhistEra

URL: https://caijiao.org/dayjs/plugin/buddhist-era
Source: docs/dayjs/plugin/buddhist-era.md
Description: BuddhistEra 插件扩展了 dayjs().format API，以支持佛历格式化，通过在年份中添加 543 来计算 BE 年份。

BuddhistEra 扩展了 `dayjs().format` API 以支持佛历格式化。

佛历是一个年份编号系统，主要用于柬埔寨、老挝、缅甸和泰国等东南亚国家以及斯里兰卡、马来西亚和新加坡的中国人，用于宗教或官方场合 ([Wikipedia](https://en.wikipedia.org/wiki/Buddhist_calendar))。

要计算 BE 年，只需在年份中添加 543。 例如，1977 年 5 月 26 日 AD / CE 应显示为 2520 年 5 月 26 日 BE（1977 + 543）。

```javascript
var buddhistEra = require("dayjs/plugin/buddhistEra");
dayjs.extend(buddhistEra);

dayjs().format("BBBB BB");
```

扩展的模版列表：

| 模版   | 输出 | 详情                       |
| ------ | ---- | -------------------------- |
| `BBBB` | 2561 | 完整佛历年 (年份 + 543)    |
| `BB`   | 61   | 佛历年 (年份 + 543) 两位数 |
