Skip to content

Add ROC year && lightweight, powerful javascript datetimepicker with no dependencies

License

Notifications You must be signed in to change notification settings

cottongrass0828/flatpickr-twyear

 
 

Repository files navigation

flatpickr-twyear

License

sample_en sample_zh-tw

Motivation

a forked and modify from Flatpickr

Feature Overview:

  • Adds support for ROC (Republic of China) calendar
  • Uses 't' as the format character for ROC dates, e.g., t-m-d

一個從 Flatpickr 進行修改的分支

功能概述:

  • 增加對民國年的支援
  • 使用 t 做為民國年的格式化字串, 如:t-m-d

New Config Options

Config Option Type Default Description
year_tw Boolean false Displays ROC era name and change year to ROC Year when enabled.

New Date Formatting Tokens

Character Description Example
t A full numeric representation of a ROC year 88 or 113

How to use

First Step:

<link rel="stylesheet" href="./flatpickr.min.css" />
<script src="./flatpickr.min.js"></script>

<!-- optional -->
<script src="./l10n/zh_tw.js"></script>

Second Step: Default Locale - ROC Calendar:

var fp = flatpickr(".date", {
  year_tw: true,
  dateFormat: "t-m-d",
});

Traditional Chinese - ROC Calendar:

var fp = flatpickr(".date", {
  locale: "zh_tw",
  year_tw: true,
  dateFormat: "t-m-d",
});

第一步:
  <link rel="stylesheet" href="./flatpickr.min.css">
  <script src="./flatpickr.min.js"></script>

  <!-- optional -->
  <script src="./l10n/zh_tw.js"></script>

第二步: 預設語系-民國年:

var fp = flatpickr(".date", {
  year_tw: true,
  dateFormat: "t-m-d",
});

繁體中文-民國年:

var fp = flatpickr(".date", {
  locale: "zh_tw",
  year_tw: true,
  dateFormat: "t-m-d",
});

一杯咖啡灌溉木棉草🌱

Buy Me a Coffee at ko-fi.com



flatpickr - javascript datetime picker

Compatibility

IE9 and up, Edge, iOS Safari 6+, Chrome 8+, Firefox 6+

Install & Use

Demos and documentation: https://flatpickr.js.org

Supporting flatpickr

flatpickr will never change its license, pester users for donations, or engage in other user-hostile behavior.

Nevertheless, if you enjoyed working with this library or if its made your life easier, you can buy me a cup of coffee :)

Buy Me a Coffee at ko-fi.com

About

Add ROC year && lightweight, powerful javascript datetimepicker with no dependencies

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • TypeScript 93.2%
  • Stylus 5.4%
  • Other 1.4%