GithubHelp home page GithubHelp logo

Comments (5)

seatechdev avatar seatechdev commented on August 25, 2024

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.

twinssbc avatar twinssbc commented on August 25, 2024

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.

seatechdev avatar seatechdev commented on August 25, 2024

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.

twinssbc avatar twinssbc commented on August 25, 2024

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.

seatechdev avatar seatechdev commented on August 25, 2024

Thanks! I handled it from the backend by using a package to manipulate dates.

from ionic2-calendar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.