Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Create Invoice Test Fail with Certain Timezones #270

Closed
enochtsang opened this issue Jan 21, 2016 · 4 comments
Closed

Create Invoice Test Fail with Certain Timezones #270

enochtsang opened this issue Jan 21, 2016 · 4 comments

Comments

@enochtsang
Copy link

I am using:

  • Linux Mint 17.1 Rebecca (64bit) (Should be similar enough to Ubuntu 14.04)
  • Google Chrome 47.0.2526.106 (Official Build) (64-bit)
  • ember 1.13.14
  • CouchDB 1.6.1 Vendor

Using a fresh install, the create-invoice test will fail with any time zone between -0500 and -1100. Time zones between -0600 and +1200 will pass. This is due to the test waiting for the visit date 11/1/2015 - 11/12/2015, but the visit date that appears is 10/31/2015 - 11/11/2015.

This will also cause 33 other tests to fail.

enochtsang added a commit to enochtsang/hospitalrun-frontend that referenced this issue Jan 23, 2016
…s 11/1/2015 - 11/12/2015, the utc dates needed to be at hour 5 for some reason though.
@enochtsang
Copy link
Author

I tried changing the code to

    triggerEvent('.invoice-patient .tt-input', 'blur');

    var utcStartTime = moment.utc('2015-11-1 05:00:00').format('YYYY-MM-DD HH:mm:ss');
    var localStartTime  = moment.utc(utcStartTime).toDate();
    localStartTime = moment(localStartTime).format('M/D/YYYY');

    var utcEndTime = moment.utc('2015-11-12 05:00:00').format('YYYY-MM-DD HH:mm:ss');
    var localEndTime  = moment.utc(utcEndTime).toDate();
    localEndTime = moment(localEndTime).format('M/D/YYYY');

    var dateRange = localStartTime + ' - ' + localEndTime;

    waitToAppear('.invoice-visit option:contains(' + dateRange + ' (Admission)');
    andThen(function() {
      select('.invoice-visit', dateRange + ' (Admission)');
      fillIn('.external-invoice-no input', 'inv000002');
    });

In invoices-test.js, which got all tests to pass in all timezones in the browser, but the create invoice test will fail the same way in the command line.

Also, I'm still unsure why I need the set the UTC time to the 5th hour to get it to pass the tests. I might guess that the dates are getting localized somewhere else where they don't need to be?

@jkleinsc

@jkleinsc
Copy link
Member

@enochtsang I'm not sure I understand what you mean when you say: " all tests to pass in all timezones in the browser, but the tests will still fail the same in the browser." Do the tests pass or fail?

As far as the UTC time, here is what is going on: when a date that doesn't require a time is entered into the system, it gets entered as midnight of that day because javascript dates always contain a time. Date/times are recorded in the system in the user's timezone/locale. When the test data was created it was created in Eastern Standard Time which is -5 UTC, thus the utc time of 05:00:00. Does that make sense? Also, just to restate, times in the system are stored as UTC/javascript dates, but what that UTC value is will be relative to the user's timezone.

@tangollama tangollama modified the milestone: HospitalRun 1.0 Feb 14, 2016
@tangollama
Copy link
Member

Adding Help Wanted for assistance in duplicating the issue for more information.

@tangollama tangollama added the help wanted indicates that an issue is open for contributions label Mar 15, 2016
@jkleinsc jkleinsc removed the help wanted indicates that an issue is open for contributions label Mar 15, 2016
@jkleinsc
Copy link
Member

This was fixed via pr #340

matteovivona pushed a commit that referenced this issue Jan 15, 2021
…rsonmodal-integration

Pull AddRelatedPersonModal tests out into integration tests
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants