Comments (10)
Would you be able to give me an actual value for correctTime
that I can test against?
I've tested the component inside a ReactNative app and the only way I can get it to say null is not an object (evaluating 'date.split')
is by giving it Number("some string")
or Number(undefined)
as the time
prop.
from react-timestamp.
Test is with this value, which is the one I'm getting from the API, in milliseconds: 1483041600000. I need to convert it to seconds in order to work with this module, otherwise I'm getting a date of year 4100~. Thanks!
from react-timestamp.
I get '30 Dec 2016' when I use Number(1483041600)
as the time
prop.
What version of react-timestamp
are you using?
from react-timestamp.
Yes, if I hard-code the value it works fine, just please try to divide the value I gave you by 1000 and then use that result as the time
prop.
from react-timestamp.
When I use this code:
render() {
var correctTime = 1483041600000;
correctTime = Math.floor(correctTime / 1000);
return (
<View style={styles.container}>
<Text>Value: {correctTime}</Text>
<Time time={Number(correctTime)} format="date" component={Text} />
</View>
);
}
I get this on screen:
from react-timestamp.
I'm doing exactly the same, but I'm using it inside a renderRow()
function of a ListView
, could you try that please?
from react-timestamp.
Components generally have no knowledge of their parent but just to make sure I tried rendering a ListView:
renderRow (post) {
var correctTime = Number(post.publish_date);
correctTime = Math.floor(correctTime / 1000);
return (
<View style={styles.cell}>
<Text style={styles.title}>{post.title}</Text>
<Text>Value: {correctTime}</Text>
<Time time={Number(correctTime)} format="date" component={Text} />
</View>
)
}
And got this:
from react-timestamp.
Ok. Well, I'm still getting the same error, so you can close this issue if you want, and I'm going to keep looking for a solution, if I find anything else I'll let you know. Thanks again for you support.
from react-timestamp.
Ok I'll close it for now but feel free to comment back here if you find out any more info.
from react-timestamp.
Ok, thanks.
from react-timestamp.
Related Issues (17)
- doesn't work
- Proposal: ability to see seconds in 'time' and 'ago' format HOT 1
- Make translations configurable HOT 1
- Add seconds support HOT 1
- Change wording when using `ago` format HOT 1
- Issue using until and since
- Please add a licence
- Utilizing React Timestamp HOT 2
- Seconds details
- Need a funtion to get value HOT 1
- error: npm install --save react-timestamp with react^18
- expected a component class, got [object Object] HOT 4
- Countdown HOT 1
- The text should have the ability of updating as time goes by HOT 1
- Uncaught TypeError: Cannot read property 'enqueueForceUpdate' of undefined HOT 1
- Support for 24-hour clock HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-timestamp.