Visitar URL original
Anyone found a way to handle Dates in Ionic production build? · Issue #36 · typeorm/ionic-example · GitHub
Skip to content
This repository was archived by the owner on Apr 24, 2026. It is now read-only.
This repository was archived by the owner on Apr 24, 2026. It is now read-only.

Anyone found a way to handle Dates in Ionic production build? #36

Description

@dave-ok

Please has anyone found a way around the date datatype problem with ionic production builds. I am building an app which is date-centric and this limitation is a downer cos typeorm has everything I need but this. Please help! I need pointers or suggestions

Activity

  1. AchevezAim commented on Jul 15, 2019

    @AchevezAim

    Is handling date as unix time an option?

  2. dave-ok commented on Jul 15, 2019

    @dave-ok
    Author

    Is handling date as unix time an option?

    Pls I dont understand. Can you elaborate?

    My question was based on the limitations listed for Ionic production builds where date types are seen as objects and eventually converted to object columns instead of date columns

    #3 (comment)

  3. AchevezAim commented on Jul 15, 2019

    @AchevezAim

    Well, I handle dates as unix time (milliseconds since epoch).

    Let's say you have:

    export class Thing {
      @PrimaryColumn({ unique: true })
      id: number;
      date: number;
    }
    

    When you fetch it, you will get date as number type, you can then use new Date(date*1000)

    Or you can make a getter that returns a date object:

    export class Thing {
      @PrimaryColumn({ unique: true })
      id: number;
      date: number;
    
     getDate(): Date{
      return new Date(this.date*1000);
     }
    }
    

    It's just a suggestion

  4. dave-ok commented on Jul 16, 2019

    @dave-ok
    Author

    @AchevezAim Thanks a bunch!
    Looks like this should work. Date comparison is critical to the project I am working on and with your suggestion I can do just that. I'll get right on it. And thanks again!

  5. Sampath-Lokuge commented on Feb 2, 2020

    @Sampath-Lokuge

    @dave-ok Is that working for you? I also like to work on this ORM library and Ionic 4. But not started yet. So how's your experience with this ORM and of course Date manipulation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions