jav / expo-server-sdk-java

Expo server SDK in java
MIT License
21 stars 23 forks source link

Weird time serialization problems after importing 'expo-server-sdk-java' #11

Closed brunoaduarte closed 3 years ago

brunoaduarte commented 4 years ago

I have i SpringBoot gradle project that i've imported 'expo-server-sdk-java'

implementation 'io.github.jav:expo-server-sdk:0.7.0'

Problem is that after this import i'm having weird behavior on Date serialization to json

Before 2020-07-07T18:49:32.142+00:00

After 2020-07-07T18:49:32.142+0000

Javascript doesn't recognize the latest as a valid date, so new Date("2020-07-07T18:49:32.142+0000") will return NaN

Probably there's some outdated or bugged dependency on this project.

jav commented 4 years ago

Hi! Would you mind sharing your projects dependencies with versions so that I may compare with this projects dependencies versions?

jav commented 4 years ago

In Firefox 78.0.1 (64-bit, Linux)

new Date("2020-07-07T18:49:32.142+0000")
Date Tue Jul 07 2020 20:49:32 GMT+0200 (Central European Summer Time)
​
<prototype>: Object { … }

new Date("2020-07-07T18:49:32.142+00:00")
Date Tue Jul 07 2020 20:49:32 GMT+0200 (Central European Summer Time)

In Chrome Version 83.0.4103.116 (Official Build) (64-bit) (Linux)

new Date("2020-07-07T18:49:32.142+0000")
Tue Jul 07 2020 20:49:32 GMT+0200 (Central European Summer Time)
new Date("2020-07-07T18:49:32.142+00:00")
Tue Jul 07 2020 20:49:32 GMT+0200 (Central European Summer Time)
jav commented 4 years ago

Which browser, browser-version and OS do you use?

brunoaduarte commented 4 years ago

Hi! Would you mind sharing your projects dependencies with versions so that I may compare with this projects dependencies versions?

plugins {
    id 'org.springframework.boot' version '2.3.0.RELEASE'
    id 'io.spring.dependency-management' version '1.0.9.RELEASE'
    id 'java'
}

group = 'org.app'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.session:spring-session-core'
//  implementation 'io.github.jav:expo-server-sdk:0.7.0'
    compile group: 'org.modelmapper', name: 'modelmapper', version: '2.3.8'
    compile group: 'com.arangodb', name: 'arangodb-spring-data', version: '3.2.5'
    compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'
    compile group: 'commons-io', name: 'commons-io', version: '2.7' 
    compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
    compile group: 'com.github.javafaker', name: 'javafaker', version: '1.0.2'
    compileOnly 'org.projectlombok:lombok'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
}

bootRun {
    if (project.hasProperty('args')) {
        args project.args.split(',')
    }
}

test {
    useJUnitPlatform()
}
brunoaduarte commented 4 years ago

Which browser, browser-version and OS do you use?

It's a React Native Expo app...

console.log(new Date("2020-07-07T18:49:32.142+00:00"));
console.log(new Date("2020-07-07T18:49:32.142+0000"));

OUTPUT

2020-07-07T18:49:32.142Z
Date { NaN }
jav commented 4 years ago

Haha! ofcourse it’s react native :) I’m not sure what I was thinking :)

On Wed, 8 Jul 2020 at 18:30, Bruno Duarte notifications@github.com wrote:

Which browser, browser-version and OS do you use?

It's a React Native Expo app...

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/jav/expo-server-sdk-java/issues/11#issuecomment-655624984, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACAQ2OIWUBOFPVCT6XHC6DR2SNKPANCNFSM4OTJQPRA .

jav commented 4 years ago

Hi.

Sorry for the update latency.

Could you provide me with a code snippet where you generate a date in Java which I could try to use to reproduce?

Thank you

jav commented 3 years ago

Please reopen if this is still an issue and you're able to help me reproduce.