Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Include timezone information in SleepStage #179

Open
kyurikotpq opened this issue Nov 23, 2024 · 0 comments
Open

Feature Request: Include timezone information in SleepStage #179

kyurikotpq opened this issue Nov 23, 2024 · 0 comments
Labels
Type: feature request New feature or request

Comments

@kyurikotpq
Copy link

kyurikotpq commented Nov 23, 2024

Thank you so much for developing this package 🙏

Describe the bug
Currently, sleep sessions and sleep stages are returned in UTC strings without timezone information:

// Example SleepStage object
{
    "stage": 4,
    "endTime": "2024-11-08T11:24:00Z",
    "startTime": "2024-11-08T11:05:00Z"
}

Timezone information is crucial because the user might travel (and thus change timezones) frequently. Without timezone offset information, records before the timezone change will always be interpreted in the device's current timezone (i.e. after the user has travelled), leading to inaccurate reporting. Things also get tricky with daylight savings if timezone offset isn't accounted for.

To Reproduce
Steps to reproduce the behavior:

  1. Use the readRecords() function, especially for SleepSession.
  2. startTime and endTime is returned in UTC strings without timezone offset information

Expected behavior
Include ZoneOffset object, similar to startZoneOffset and endZoneOffset available in ExerciseSessionRecord

// node_modules/react-native-health-connect/src/types/base.types.ts
export interface SleepStage {
  startTime: string;
  endTime: string;
  // Use SleepStageType constant
  stage: number;

  // Requested feature
  startZoneOffset?: ZoneOffset;
  endZoneOffset?: ZoneOffset;
}

Environment:

  • react-native-health-connect Version: 3.1.0
  • Android API Level: Android 14 & 15
@matinzd matinzd added Type: feature request New feature or request and removed Type: bug labels Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants