talalmajali / react-native-countdown-component

React Native CountDown
MIT License
266 stars 233 forks source link

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

Open qq3094128766 opened 4 years ago

qq3094128766 commented 4 years ago

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

Simacho239 commented 4 years ago

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.

qq3094128766 commented 4 years ago

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

alz10 commented 3 years ago

@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