Taiwan format support for momentjs
Switch branches/tags
Nothing to show
Clone or download
Latest commit 9061616 Jun 7, 2017
Permalink
Failed to load latest commit information.
src remove the default value of year May 5, 2016
target some changes May 11, 2016
test remove the default value of year May 5, 2016
.gitignore some changes Sep 14, 2015
.travis.yml update npm key Jun 7, 2017
Gruntfile.js let it support nodejs Dec 10, 2015
LICENSE let it support nodejs Dec 10, 2015
README.md update readme Dec 16, 2015
bower.json initialize Sep 14, 2015
package.json some changes May 5, 2016

README.md

#moment-taiwan A Taiwan calendar system plugin for moment.js.

Status

Build Status

#About

Taiwan calendar is a calendar which used in Taiwan, China. Read more on Wikipedia or see Calendar Converter.

This plugin adds Taiwan calendar support to momentjs library.

Calendar conversion as below,

  • Gregorian to Taiwan
    year < 1911 : year - 1912
    year > 1911 : year - 1911
  • Taiwan to Gregorian
    year >= 1 : year + 1911
    year == 0 : 1912
    year < 0 : year + 1912

#Where to use it

In Browser

You may use the target/moment-taiwan.js file.

<script src="moment.js"></script>
<script src="moment-taiwan.js"></script>
<script>
  moment().format('tYY/MM/DD');
</script>

NodeJS

var tw = require('moment-taiwan');
var date = moment('104/10/20', 'tYY/MM/DD');

#API

This plugin tries to mimic momentjs api. Basically, when you want to format or parse a string, use tYY. For example:

m = moment('104/01/01', 'tYY/MM/DD') // Parse a Taiwan date
m.format('tYY/MM/DD [is] YYYY/M/D') // 104/01/01 is 2015/01/01

m.twYear() // 104

#License

MIT