Skip to content

Commit 7f01ea4

Browse files
author
WangXiaoxuan
committed
Add new prop firstDay
1 parent 0115dce commit 7f01ea4

File tree

7 files changed

+44
-15
lines changed

7 files changed

+44
-15
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ A sample screenshot is here,
136136

137137
5. **titleFormat**
138138

139+
6. **firstDay** : first day of the week, `Number`, default: 0 (Sunday)
140+
Sunday=0, Monday=1, Tuesday=2, etc.
141+
Any number smaller than 0 or larger than 6 will be set to 0.
142+
139143
#### events
140144

141145
fc will dispatch some events out.

demo/app.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<p>
44
Here is the demo of vue-fullcalendar, no jquery fullcalendar.js required!
55
</p>
6-
<full-calendar class="test-fc" :events="fcEvents" lang="en"></full-calendar>
6+
<full-calendar class="test-fc" :events="fcEvents" lang="en" first-day='0'></full-calendar>
77
</div>
88
</template>
99
<script>
1010
let demoEvents = [
1111
{
12-
title : 'Sunny 728-730',
12+
title : 'Sunny 725-727',
1313
start : '2016-07-25',
1414
end : '2016-07-27',
1515
cssClass : 'family'

dist/vue-fullcalendar.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,16 @@ return /******/ (function(modules) { // webpackBootstrap
463463
type: String,
464464
default: 'zh'
465465
},
466+
firstDay: {
467+
type: Number,
468+
coerce: function coerce(val) {
469+
var res = parseInt(val);
470+
if (res < 0 || res > 6) return 0;
471+
return res;
472+
},
473+
474+
default: 0
475+
},
466476
titleFormat: {
467477
type: String,
468478
default: function _default() {
@@ -478,7 +488,8 @@ return /******/ (function(modules) { // webpackBootstrap
478488
weekNames: {
479489
type: Array,
480490
default: function _default() {
481-
return _langSets2.default[this.lang].weekNames;
491+
var arr = _langSets2.default[this.lang].weekNames;
492+
return arr.slice(this.firstDay).concat(arr.slice(0, this.firstDay));
482493
}
483494
}
484495
},
@@ -521,7 +532,8 @@ return /******/ (function(modules) { // webpackBootstrap
521532
// </div>
522533
// </fc-header>
523534
// <!-- body display date day and events -->
524-
// <fc-body :current-date="currentDate" :events="events" :month-names="monthNames" :week-names="weekNames">
535+
// <fc-body :current-date="currentDate" :events="events" :month-names="monthNames"
536+
// :week-names="weekNames" :first-day="firstDay">
525537
// <div slot="body-card">
526538
// <slot name="fc-body-card">
527539
// </slot>
@@ -637,7 +649,8 @@ return /******/ (function(modules) { // webpackBootstrap
637649
currentDate: {},
638650
events: {},
639651
weekNames: {},
640-
monthNames: {}
652+
monthNames: {},
653+
firstDay: {}
641654
},
642655
created: function created() {
643656
this.events.forEach(function (item, index) {
@@ -705,7 +718,7 @@ return /******/ (function(modules) { // webpackBootstrap
705718

706719
var curWeekDay = startDate.getDay();
707720
// begin date of this table may be some day of last month
708-
startDate.setDate(startDate.getDate() - curWeekDay);
721+
startDate.setDate(startDate.getDate() - curWeekDay + this.firstDay);
709722

710723
var calendar = [];
711724
// let isFinal = false
@@ -1280,7 +1293,7 @@ return /******/ (function(modules) { // webpackBootstrap
12801293
/* 19 */
12811294
/***/ function(module, exports) {
12821295

1283-
module.exports = "\n <div class=\"comp-full-calendar\">\n <!-- header pick month -->\n <fc-header :current-date.sync=\"currentDate\" :title-format=\"titleFormat\">\n\n <div slot=\"header-right\">\n <slot name=\"fc-header-right\">\n </slot>\n </div>\n </fc-header>\n <!-- body display date day and events -->\n <fc-body :current-date=\"currentDate\" :events=\"events\" :month-names=\"monthNames\" :week-names=\"weekNames\">\n <div slot=\"body-card\">\n <slot name=\"fc-body-card\">\n </slot>\n </div>\n </fc-body>\n </div>\n";
1296+
module.exports = "\n <div class=\"comp-full-calendar\">\n <!-- header pick month -->\n <fc-header :current-date.sync=\"currentDate\" :title-format=\"titleFormat\">\n\n <div slot=\"header-right\">\n <slot name=\"fc-header-right\">\n </slot>\n </div>\n </fc-header>\n <!-- body display date day and events -->\n <fc-body :current-date=\"currentDate\" :events=\"events\" :month-names=\"monthNames\" \n :week-names=\"weekNames\" :first-day=\"firstDay\">\n <div slot=\"body-card\">\n <slot name=\"fc-body-card\">\n </slot>\n </div>\n </fc-body>\n </div>\n";
12841297

12851298
/***/ }
12861299
/******/ ])

0 commit comments

Comments
 (0)