Opened 10 years ago

Closed 10 years ago

#607 closed Request (fixed)

Date /time format is different in configuration file and GUI

Reported by: Nicklas Nordborg Owned by: olle
Priority: trivial Milestone: LabEnv v1.2
Component: net.sf.basedb.labenv Keywords:
Cc:

Description

In labenv-config.xml the <startdate> must be entered in YYYY-MM-DD format, but <starttime> and <endtime> for alarms are entered as HHMM (I expected HH:MM).

When using the web interface dates are entered in YYYYMMDD format and times are entered in HHMM format.

I think date and time formats should be consistent and suggest that dates/times without any separators are supported everywhere (could still support YYYY-MM-DD by simply removing all '-' in the string).

Change History (5)

comment:1 by olle, 10 years ago

Status: newassigned

Ticket accepted.

comment:2 by olle, 10 years ago

Traceability note:

  • The lab environment extension was introduced in Ticket #529 (Retrieve and store temperature and humidity measurements).
  • The lab environment extension was updated in Ticket #592 (Lab environment extension improved report routines), specifically regarding graphs of lab environment data for a chosen time interval, new time filters, and improved alarm functionality.

comment:3 by olle, 10 years ago

Design update:

  • The lab environment extension configuration file should accept lab sensor start date both in YYYYMMDD and YYYY-MM-DD format. It will be stored in YYYY-MM-DD format, since this simplifies readability of simple print-out in lab sensor info page and logs.
  • The lab environment extension configuration file should accept alarm start and end times in HHMM, HH:MM, HHMMSS, and HH:MM:SS formats. It will be stored in HHMM format (if seconds have been specified, these will be skipped, i.e. the minute entry will not be incremented if the number of seconds >= 30.

Implementation:

  1. Class/file LabEnvironmentConfiguration.java in src/net/sf/basedb/labenv/ updated:
    a. Private method void fetchConfiguration() updated to call new private convenience method String convertToDateStringWithHyphens(String dateStr) to convert input sensor start date to format YYYY-MM-DD.
    b. Private method List<LabSensorAlarmConfig> fetchLabSensorAlarmList(Element labSensorTag, Namespace ns) updated to call new private convenience method String convertToTimeStringInFormatHHMM(String timeStr) to convert input alarm start and end times to HHMM format.
    c. New private convenience method String convertToDateStringWithHyphens(String dateStr) added. It converts input date string from format YYYYMMDD to YYYY-MM-DD, if necessary.
    d. New private convenience method String convertToTimeStringInFormatHHMM(String timeStr) added. It converts input time string from formats HHMMSS, HH:MM:SS, and HH:MM to HHMM, if necessary. If input time contains seconds, the latter will be dropped, i.e. the minute entry will not be incremented if the number of seconds >= 30.

comment:4 by olle, 10 years ago

(In [2532]) Refs #607. Lab environment extension configuration file updated to accept lab sensor start date both in YYYYMMDD and YYYY-MM-DD format, and alarm start and end times in HHMM, HH:MM, HHMMSS, and HH:MM:SS formats:

  1. Class/file LabEnvironmentConfiguration.java in src/net/sf/basedb/labenv/ updated:
    a. Private method void fetchConfiguration() updated to call new private convenience method String convertToDateStringWithHyphens(String dateStr) to convert input sensor start date to format YYYY-MM-DD.
    b. Private method List<LabSensorAlarmConfig> fetchLabSensorAlarmList(Element labSensorTag, Namespace ns) updated to call new private convenience method String convertToTimeStringInFormatHHMM(String timeStr) to convert input alarm start and end times to HHMM format.
    c. New private convenience method String convertToDateStringWithHyphens(String dateStr) added. It converts input date string from format YYYYMMDD to YYYY-MM-DD, if necessary.
    d. New private convenience method String convertToTimeStringInFormatHHMM(String timeStr) added. It converts input time string from formats HHMMSS, HH:MM:SS, and HH:MM to HHMM, if necessary. If input time contains seconds, the latter will be dropped, i.e. the minute entry will not be incremented if the number of seconds >= 30.

comment:5 by olle, 10 years ago

Resolution: fixed
Status: assignedclosed

Ticket closed since the lab extension configuration file now accepts date and time entries in several formats.

Note: See TracTickets for help on using tickets.