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

Processing based on time zone #53

Closed
Tracked by #1465
mahalakshme opened this issue Aug 1, 2024 · 4 comments
Closed
Tracked by #1465

Processing based on time zone #53

mahalakshme opened this issue Aug 1, 2024 · 4 comments
Assignees

Comments

@mahalakshme
Copy link
Contributor

mahalakshme commented Aug 1, 2024

Steps:

  • Login to maha@cd, prerelease env
  • and do School Monitoring encounters for 'ABC Vidhyalaya'
  • All dates times are converted to/displayed in IST from UTC in the db - when we do console.log in a rule or in mobile app UI, it is the IST datetime that displays.
  • In prod env, Cini - visit schedule rule for the above encounter type has 6 hours added thinking the UTC to IST conversion is not done at product level

AC:

  • Identify where the above conversion is made.

Need:

The above is needed because as per the implementation team, the conversion doesn't happen. Identifying where we are doing the above, will help us to identify if any edge cases exist, that needs to be fixed.

Old: Ignore

Have a configuration - of country somewhere

Image

Inputs:

  • default report cards, VSR
  • Region in Account
  • search filter
  • audit fields
  • API?
  • which screen?
  • account admin - not useful but used
  • get the timezone from mobile app - is the timezone in mobile app reliable?
  • CK sitting in US
@mahalakshme mahalakshme converted this from a draft issue Aug 1, 2024
@mahalakshme mahalakshme moved this from In Analysis to In Analysis Review in Avni Product Sep 4, 2024
@mahalakshme mahalakshme changed the title [Helper] For converting date fields to IST Introducing timezone concept Sep 4, 2024
@mahalakshme mahalakshme changed the title Introducing timezone concept Processing based on time zone Sep 4, 2024
@mahalakshme mahalakshme moved this from In Analysis Review to Analysis Complete in Avni Product Sep 10, 2024
@mahalakshme mahalakshme moved this from Analysis Complete to Ready in Avni Product Sep 17, 2024
@petmongrels petmongrels self-assigned this Sep 19, 2024
@petmongrels
Copy link
Contributor

@petmongrels
Copy link
Contributor

petmongrels commented Sep 23, 2024

our dates are like "2024-03-23T06:08:45.000Z" in the offline db. Using Z in the timestamp means UTC. When we display the date using console.log we are shown the date in human friendly timezone converted format. Check this link for more on date being initialised with string - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format

There is no issue in Avni mobile wrt to date being in UTC

  • The dates present in UTC in the offline db, when instantiated using new Date they all represent same global instant of time.
  • Even this prints out moment(new Date("2024-08-31T18:30:00.000Z")).format("MMMM") gives out correct month which is September.
  • all moment manipulation like adding months etc are all correct.

@petmongrels petmongrels moved this from In Progress to Code Review Ready in Avni Product Sep 23, 2024
petmongrels added a commit to avniproject/avni-client that referenced this issue Sep 23, 2024
@mahalakshme
Copy link
Contributor Author

@petmongrels where is the conversion happening? How does it know it needs to convert to IST?

@petmongrels
Copy link
Contributor

The timezone comes from the JS runtime environment. It is just the display that is changed.
We can use sensors feature to test this out. Same date will be shown differently by changing the geolocation - https://www.youtube.com/watch?v=pIpN_AuV4AI

@1t5j0y 1t5j0y moved this from Code Review Ready to Done in Avni Product Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

3 participants