We're updating the issue view to help you get more done. 

Date select field jumps one day early in Stock Management UI

Description

In all screens with a date picker, the error was identified in Stock Management, when you pick a date on a date select field, the system jumps the value to one day earlier (pick 31 Jan and it changes the value to 30 Jan).

Please make sure the fix is reflected in all screens:

  • Stock Management > Adjustments;

  • Stock Management > Issue

  • Stock Management > Receive;

  • Stock Management > Physical inventory;

  • CCE > CCE Inventory;

  • Orders > View Orders;

  • Requisitions > View Requisitions;

  • Administration > Facilities.

Steps to Reproduce
1. Log in as srmanager2 (or any user who can do Stock Management Receipts and Physical Inventories)
2. Navigate to Stock Management > Receive
3. Click Make Receive for any program (eg Essential Medicines)
4. Select a product (any product), add a Lot (if needed), and click Add button
5. Enter Quantity (eg 10); choose any Received From and Reason values.
6. Click into Date field, calendar pops up, choose 31 January 2017.
7. ERROR: After 1 second the field value changes from 31 to 30 January 2017. It appears to change to the previous day regardless of what day you pick.
(Note: I believe this issue happens from any time zone and happens at any time of the day, but I reproduced in US Eastern time zone at 10:00am EST and 1:00PM EST in Chrome. It's possible the bug won't happen if your local computer time is in a different timezone or if it is later in the evening when you test. Please update ticket if so.)

Video demo
https://youtu.be/IoFmvEmFtfs

Other Steps to Reproduce/Other Locations of this bug

  • Same issue happens in Stock Management > Physical Inventory, but the date select field appears in a modal after you click Submit. Screenshot attached showing this.

  • Same in Stock Management > Issue > Make Issue.

  • Same in Stock Management > Adjustments > Make Adjustment.

It's possible this same bug appears with other date fields (please update ticket if we identify other cases).

Verified/Reproduced in v3.2.1 as well as in current latest snapshots.

Acceptance Criteria

  • Add units tests for this UI component (we want automated tests to catch this/prevent regressions)

  • Date fields should keep the date that the user entered into them (not jump a day earlier). This should work regardless of what time zone the user is in when using OpenLMIS. (Browser time zone should not be involved when calculating our business date fields – business date fields do not have a time).

Environment

None

Status

Assignee

Mateusz Kwiatkowski

Reporter

Brandon Bowersox-Johnson

Labels

None

Story Points

3

Time tracking

20h

Epic Link

Components

Sprint

None

Fix versions

Affects versions

3.2.1

Priority

Critical