|
58 | 58 | box-sizing: border-box; |
59 | 59 | } |
60 | 60 |
|
| 61 | + |
61 | 62 | body { |
62 | 63 | overflow: hidden; |
63 | 64 | font-family: 'HelveticaNeue-UltraLight', 'Helvetica Neue UltraLight', 'Helvetica Neue', Arial, Helvetica, sans-serif; |
|
800 | 801 | this.today = moment(); |
801 | 802 | } |
802 | 803 | this.$.calendar.innerHTML = ''; |
803 | | - this.calendar = this._Calendar(this.$.calendar, this._convertMillsDate( |
804 | | - this.data)); |
| 804 | + if(!this.data){ |
| 805 | +//dummy data |
| 806 | + this.data=JSON.parse('[{ "eventName": "Lunch Meeting w/ Mark", "category": "Work", "color": "orange","date":"14913220913940" }]'); |
| 807 | + } |
| 808 | + this.calendar = this._Calendar(this.$.calendar, |
| 809 | + this.data); |
805 | 810 | } |
806 | 811 | _Calendar(selector, event) { |
807 | 812 |
|
|
992 | 997 | var self = this; |
993 | 998 | if (day.month() === this.current.month()) { |
994 | 999 | var todaysEvents = this.events.reduce(function (memo, ev) { |
| 1000 | + // ev.date = ev.date.replace(/['"]+/g, ''); |
| 1001 | + var dateType=typeof ev.date |
| 1002 | +if (dateType=="string"){ |
| 1003 | + |
| 1004 | + |
| 1005 | + ev.date=JSON.parse(ev.date); |
| 1006 | + var dateType=typeof ev.date |
| 1007 | +} |
| 1008 | + if(dateType=="number") { |
| 1009 | + ev.date = moment(parseInt(ev.date)) |
| 1010 | + // ev.isDateFormat=true |
| 1011 | + } |
995 | 1012 | if (ev.date.isSame(day, 'day')) { |
996 | 1013 | memo.push(ev); |
997 | 1014 | } |
|
1202 | 1219 | return ele; |
1203 | 1220 | } |
1204 | 1221 | _convertMillsDate(data) { |
| 1222 | + |
| 1223 | + |
1205 | 1224 | if(!data){ |
1206 | 1225 |
|
1207 | 1226 | data=JSON.parse('[{ "eventName": "Lunch Meeting w/ Mark", "category": "Work", "color": "orange","date":"14913220913940" }]'); |
1208 | 1227 | } |
1209 | 1228 | data.forEach(function (ev) { |
1210 | | - if(!ev.isDateFormat) { |
| 1229 | + if(typeof ev.date=="number") { |
1211 | 1230 | ev.date = moment(parseInt(ev.date)) |
1212 | | - ev.isDateFormat=true |
| 1231 | + // ev.isDateFormat=true |
1213 | 1232 | } |
1214 | 1233 | // ev.date = self.current.clone().date(Math.random() * (29 - 1) + 1); |
1215 | 1234 | }); |
|
0 commit comments