Skip to content
This repository was archived by the owner on Nov 16, 2022. It is now read-only.
This repository was archived by the owner on Nov 16, 2022. It is now read-only.

When counting down to same day, targetFormatMask is one day off #197

@Alwyn-RM

Description

@Alwyn-RM

I have 2 moments. One moment I add x seconds. When using the targetFormatMask to show the number of remaining days it always shows 1.
OnTick shows correct number of seconds left and onCountdownEnd is called when time is over.

I'm using this format "DD [days] - HH:mm:ss" but it's the same with "DD:HH:mm:ss"

const dateInFuture = moment().add(60, "seconds");

<ReactMomentCountDown
	toDate={dateInFuture}
	targetFormatMask="DD [days] - HH:mm:ss"
	onTick={onTick}
	onCountdownEnd={onCountdownEnd}
/>

Shows 01 DAYS - 00:00:59 counting down to 01 DAYS - 00:00:00

Probably because you convert to UTC time which is 1st of january 1970 so D will always show 1. Subsquentially 25hrs in the future will say it's 2 days and 1 hour because it converts to 1/2/1970

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions