Giter Site home page Giter Site logo

moment-buddhist-era.js's Introduction

Moment Buddhist Era

npm version npm downloads Github Actions CI Codecov License

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/2562

Disabled Buddhist Era

moment.buddhistEra(false)
moment('2019-06-27T02:15:07+07:00').format('MM/DD/YYYY') // 06/27/2019

Disabled Buddhist Era in format method

moment('2019-06-27T02:15:07+07:00').format('MM/DD/YYYY', { be: false }) // 06/27/2019

Using 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

MIT License

Copyright (c) 2021 Chettapong Pinsuwan

moment-buddhist-era.js's People

Contributors

chettapong avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.