1.0.11 • Published 5 years ago

@owneul/kate v1.0.11

Weekly downloads
13
License
MIT
Repository
github
Last release
5 years ago

Kate

Very Simple Date data manage Module(javascript)

NPM Version

Install

npm i @owneul/kate

Usage

var kate = new Kate('2019년 4월 18일');
var formatted = kate.format('yyyy.mm.dd ap h시 i분 s초');
console.log(formatted); // 2019.04.18 오전 12시 0분 0초

// add~ methods return copy of Kate Object. (new Instance)
var copied = kate.addDays(10);
console.log(copied.format('yy/m/d HH:ii:ss')); // 19/4/28 00:00:00

// set~ methods return original Kate Object. (not create new Instance)
kate.setHours(23).setMinutes(59).setSeconds(59); // 2019.04.18 오후 11시 59분 59초
console.log(kate.format('yyyy.mm.dd ap h시 i분 s초'));

var dateIntervalFrom1991_02_01 = kate.diffInDays('1991-02-01');
console.log(dateIntervalFrom1991_02_01); // -10303

format() arguments

replacetoresult
yyyyFull Year(4)1991
yySimple Year(2)91
mmzerofilled month02
mnon-zerofill month2
ddzerofilled date01
dnon-zerofill date1
Eday label금(Fri)
HHzerofilled hours(24H)17
Hnon-zerofill hours(24H)5
hhzerofilled hours(12H)05
hnon-zerofill hours(12H)5
iizerofilled minutes09
inon-zerofill minutes9
sszerofilled minutes01
snon-zerofill minutes1
apmeridiem label오전(AM)

set custom labels

Kate.setMeridiemLabels(['AM', 'PM']);
Kate.setDayLabels(['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']); // start with sunday

License

MIT

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago