首页 > 代码库 > js非常强大的日历控件fullcalendar.js, 日期时间库: moment.js

js非常强大的日历控件fullcalendar.js, 日期时间库: moment.js

日历控件:

https://fullcalendar.io/docs/

https://fullcalendar.io/docs/event_data/events_function/

https://fullcalendar.io/docs/event_data/Event_Object/

https://fullcalendar.io/docs/mouse/eventClick/

<!DOCTYPE html><html><head><meta charset=‘utf-8‘ /><link href=http://www.mamicode.com/‘../fullcalendar.css‘ rel=‘stylesheet‘ />"Meeting" must be dropped				{					id: ‘availableForMeeting‘,					start: ‘2015-02-11T10:00:00‘,					end: ‘2015-02-11T16:00:00‘,					rendering: ‘background‘				},				{					id: ‘availableForMeeting‘,					start: ‘2015-02-13T10:00:00‘,					end: ‘2015-02-13T16:00:00‘,					rendering: ‘background‘				},				// red areas where no events can be dropped				{					start: ‘2015-02-24‘,					end: ‘2015-02-28‘,					overlap: false,					rendering: ‘background‘,					color: ‘#ff9f89‘				},				{					start: ‘2015-02-06‘,					end: ‘2015-02-08‘,					overlap: false,					rendering: ‘background‘,					color: ‘#ff9f89‘				}			]			*/		});			});</script><style>	body {		margin: 40px 10px;		padding: 0;		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;		font-size: 14px;	}	#calendar {		max-width: 900px;		margin: 0 auto;	}</style></head><body>	<div id=‘calendar‘></div></body></html>

  

 

日期时间库:

http://momentjs.com/

Parse, validate, manipulate, and display dates and times in JavaScript.

//Format Datesmoment().format(‘MMMM Do YYYY, h:mm:ss a‘);moment().format(‘dddd‘);moment().format("MMM Do YY");moment().format(‘YYYY [escaped] YYYY‘);moment().format();//Relative Timemoment("20111031", "YYYYMMDD").fromNow();moment("20120620", "YYYYMMDD").fromNow();moment().startOf(‘day‘).fromNow();moment().endOf(‘day‘).fromNow();moment().startOf(‘hour‘).fromNow();//Calendar Timemoment().subtract(10, ‘days‘).calendar();moment().subtract(6, ‘days‘).calendar();moment().subtract(3, ‘days‘).calendar();moment().subtract(1, ‘days‘).calendar();moment().calendar();moment().add(1, ‘days‘).calendar();moment().add(3, ‘days‘).calendar();moment().add(10, ‘days‘).calendar();//Multiple Locale Supportmoment.locale();moment().format(‘LT‘);moment().format(‘LTS‘);moment().format(‘L‘);moment().format(‘l‘);moment().format(‘LL‘);moment().format(‘ll‘);moment().format(‘LLL‘);moment().format(‘lll‘);moment().format(‘LLLL‘);moment().format(‘llll‘);

PS:

当前日期时间格式化:

moment().format(‘YYYY-MM-DD HH:mm:ss.SSS‘)

ref: http://momentjs.com/docs/#/displaying/

 

js非常强大的日历控件fullcalendar.js, 日期时间库: moment.js