react-native-countdown-component icon indicating copy to clipboard operation
react-native-countdown-component copied to clipboard

until more than 1 day, i don't need day

Open qq3094128766 opened this issue 6 years ago • 3 comments

timeLabels={{h: null, m: null, s: null}} i only need h,m,s, i hope display 29:34:59 will be display problems

<CountDown style={{paddingBottom:5}} until={106500} onFinish={() => console.log('finished')} size={15} timeToShow={['H', 'M', 'S']} timeLabels={{h: null, m: null, s: null}} showSeparator={true} digitStyle={{backgroundColor: '#333', width:25, height:25}} digitTxtStyle={{color: 'white'}} />

image

qq3094128766 avatar Dec 16 '19 11:12 qq3094128766

You can achieve this now with some tweaking to the index.js source file for this module. If you go into your node_modules folder and find the folder for this module, open up the index.js file and go to the getTimeLeft function.

Where you currently have:

hours: parseInt(until / (60 * 60), 10) % 24,

Replace it with:

hours: parseInt(until / (60 * 60), 10) % 24 + parseInt(until / (60 * 60 * 24), 10) * 24,

This will add 24 hours to your hour count for every day value that would've displayed within the day box. Note that you'll need to remodify this line every time your node modules update as it will reset it back to the original function.

Simacho239 avatar Feb 07 '20 01:02 Simacho239

thanks, I know this solution, if everyone in svn / git needs to modify the node modules, Hope the author can accept #64 pull requests

qq3094128766 avatar Feb 08 '20 11:02 qq3094128766

@Simacho239 how do you do it when you only need to display in minutes? For example instead of 03:00:00 hours i want to display 180:00 minutes

alz10 avatar Dec 03 '20 14:12 alz10