@chettapong/moment-buddhist-era.js
v0.0.7
Published
Buddhist Era (B.E.) support plugin for Moment.js
Downloads
140
Maintainers
Readme
Moment Buddhist Era
Buddhist Era plugin for Moment.js
Features
- Buddhist Era (B.E.) support
Setup
Browser
Grab the file as well as moment.js. Then simply reference Moment Buddhist Era after Moment:
<script src="moment.min.js"></script>
<script src="moment-buddhist-era.js"></script>If you want to pull from a CDN, this one is automatically kept up to date.
Node.js
Add @chettapong/moment-buddhist-era.js dependency to your project
yarn add --dev @chettapong/moment-buddhist-era.js # or npm install --save-dev @chettapong/moment-buddhist-era.js// CommonJS
var moment = require('moment');
require('@chettapong/moment-buddhist-era.js');// ESM
import moment from 'moment';
import '@chettapong/moment-buddhist-era.js';Usage
Format
moment('2019-06-27T02:15:07+07:00').format('MM/DD/YYYY') // 06/27/2562Disabled Buddhist Era
moment.buddhistEra(false)
moment('2019-06-27T02:15:07+07:00').format('MM/DD/YYYY') // 06/27/2019Disabled Buddhist Era in format method
moment('2019-06-27T02:15:07+07:00').format('MM/DD/YYYY', { be: false }) // 06/27/2019Using with TypeScript
Add @chettapong/moment-buddhist-era.js to the compilerOptions.types section of your project's tsconfig.json file:
{
"compilerOptions": {
"types": [
"@chettapong/moment-buddhist-era.js",
]
},
}License
Copyright (c) 2021 Chettapong Pinsuwan
