Comments (5)
This is how I resolved it but I don't think its the most optimum way to do it since a user can have thousands of events over time time. I had to do this after storing the date and time using the default ion-datetime format. I am leaving it open so that if the developer of ionic2-Calendar or anyone else has a better suggestion. Ideally I would like to resolve it at the time of submitting my event instead of getting the payload full of events via my API. This loop is going to degrade the performance but ti works. I tried storing the dates by running them through new Date()
but that didn't work.
var i;
var countData = res.length; // res is my api response in the json format
for (i = 0; i < countData; i++) {
this.eventSource[i].startTime = new Date(this.eventSource[i].startTime);
this.eventSource[i].endTime = new Date(this.eventSource[i].endTime);
}
from ionic2-calendar.
The data type and format you store and display are not necessarily the same.
Since there could be different date time format of a string, so the calendar as a generic component can't support every type. So it accepts Date type which is common, and let the backend service to return the response properly.
from ionic2-calendar.
Fair enough. Thank you for your reply. However, since in this case I am using my own API to generate the JSON (which I am sure lot of developers will be doing), can you please recommend a format e.g. YYYY-MM-DDTHH:MM:SS.000Z that I can store my date string in so that I don't have go through extra processing and the JSON response can work out of the box.
from ionic2-calendar.
Fair enough. Thank you for your reply. However, since in this case I am using my own API to generate the JSON (which I am sure lot of developers will be doing), can you please recommend a format e.g. YYYY-MM-DDTHH:MM:SS.000Z that I can store my date string in so that I don't have go through extra processing and the JSON response can work out of the box.
The calendar doesn't support String format of the startTime and endTime. You have to construct a Date object based on what you stored.
from ionic2-calendar.
Thanks! I handled it from the backend by using a package to manipulate dates.
from ionic2-calendar.
Related Issues (20)
- Ionic/angular 7 support HOT 11
- Change week view HOT 2
- ionic 7 app - install fails HOT 4
- upgrade to angular 16.x and ionic 5.x problem select mutliple date HOT 5
- could you include the version 9.x of swipper in ionic2-calendar ? HOT 4
- Error: node_modules/ion2-calendar/dist/calendar.module.d.ts:8:60 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s). [ng] [ng] 8 static forRoot(defaultOptions?: CalendarModalOptions): ModuleWithProviders HOT 1
- Update to ionic 7 HOT 1
- How to change row height ? HOT 1
- Module '"swiper/types"' has no exported member 'SwiperOptions'. HOT 6
- ionic 7 angular 15 swiper 9 compatibility HOT 2
- [EDIT] MonthView on Android: swipe behavior when the screen is Swiped HOT 7
- Ionic 6 Angular 13 swiping problem HOT 2
- How to change the event background color? HOT 1
- Day view dynamic color change does it only for the first half an hour HOT 2
- Accessing Event Details in a child view HOT 1
- Angular 17 support HOT 3
- Ionic 7 week view header appears in the wrong place HOT 1
- Version 2.2.x error with multiple calendars in the same mode HOT 3
- swiper 11 support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ionic2-calendar.