Skip to content

new Date() bug #15819

@Gigasz

Description

@Gigasz

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

No

Environment

  1. react-native -v:
    react-native-cli: 2.0.1
    react-native: 0.46.4

  2. node -v: v7.10.0

  3. npm -v: 4.2.0

  4. yarn --version:

Then, specify:

  • Target Platform: iOS 11.0
  • Development Operating System: macOS Sierra
  • Build tools: xCode9 beta

Steps to Reproduce

Not sure if it's a react-native issue or iOS, but i'm setting a new Date('string') -the string comes from the server- and it converts to a Date on iOS emulator, however when I run on device it becomes an invalid date (as I console logged on xCode).

here the logs:

the log scheme: console.log('string identifier', 'new Date(string)', date string from server);

log commands:
console.log('dtini', dataInicio, this.props.programacaoLazer[i].data_inicio);
console.log('dtfim', dataFim, this.props.programacaoLazer[i].data_fim);
console.log('dtselec', this.state.dataSelecionada);
log on emulator:
dtini Tue Sep 05 2017 10:40:00 GMT-0300 (-03) 2017-09-05 10:40:00
dtfim Tue Sep 26 2017 13:18:00 GMT-0300 (-03) 2017-09-26 13:18:00
dtselec Tue Sep 05 2017 15:29:06 GMT-0300 (-03)

log on Xcode running on device:
2017-09-05 15:21:50.326 [info][tid:com.facebook.react.JavaScript] 'dtini', Invalid Date, '2017-09-05 10:40:00'
2017-09-05 15:21:50.326 [info][tid:com.facebook.react.JavaScript] 'dtfim', Invalid Date, '2017-09-26 13:18:00'
2017-09-05 15:21:50.327 [info][tid:com.facebook.react.JavaScript] 'dtselec', Tue Sep 05 2017 15:18:37 GMT-0300 (-03)

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions