ntls-io / nautilus-wallet

Nautilus Wallet
GNU Affero General Public License v3.0
8 stars 4 forks source link

feat(web-client): Recurring payments feature. #598

Closed IscoRuta98 closed 1 year ago

IscoRuta98 commented 1 year ago

Implementation of Frontend Recurring Payment feature.

netlify[bot] commented 1 year ago

Deploy Preview for nautilus-wallet-staging ready!

Name Link
Latest commit 47c7c50fe5afa742635519710cfc7c8a165306d8
Latest deploy log https://app.netlify.com/sites/nautilus-wallet-staging/deploys/64a402fee978ea00089737ec
Deploy Preview https://deploy-preview-598--nautilus-wallet-staging.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

billguo99 commented 1 year ago

Nice, just a few minor feedback:

One more fix:

You'll need to use the following typescript function to convert a Date object to their ordinal value:

const _DAYS_IN_MONTH: number[] = [-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

function isLeapYear(year: number): boolean {
    // year -> 1 if leap year, else 0.
    return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
}

function getDateToOrdinal(date: Date): number {
    const year = date.getFullYear();
    const month = date.getMonth() + 1;
    const day = date.getDate();

    return (
        (year - 1) * 365 +
        Math.floor((year - 1) / 4) -
        Math.floor((year - 1) / 100) +
        Math.floor((year - 1) / 400) +
        _DAYS_IN_MONTH.slice(1, month).reduce((acc, curr) => acc + curr, 0) +
        (month > 2 && isLeapYear(year) ? 1 : 0) +
        day
    );
}