Hello,
I'm working with XSJS, and have created a table via hdbschema file like this:
@Catalog.tableType : #COLUMN Entity TimeLog { key ID: Integer; START_DATE: LocalDate default '0000-00-00'; START_TIME: LocalTime default '00:00:00'; };
If I query the table via SQL command directly on catalog explorer, I get dates and time with the format specified by the data type:
YYYY-MM-DD for START_DATE
and
HH:MM:SS for START_TIME
however, in my XSJS code, when I query via XSDS interface:
var TimeLog = XSDS.$importEntity("timerecording.data", "databaseobjects.TimeLog", { ID: { $key: "\"TIMERECORDING\".\"timerecording.data::timeLogId\"" } }); var tlObject = TimeLog.$query() .$where(TimeLog.ID.$eq(id)) .$execute({$factorized: true, $flat: true});
I'm getting:
{ "ID": 128, "START_DATE": "2018-01-01T00:00:00.000Z", "START_TIME": "-000001-12-31T13:05:00.000Z", }
As you can see, even though my fields are defined as date only and time only, both of them are displayed as datetime. That's wrong and also a problem, because even if I try to parse time to right format using js code, when I perform new Date(START_TIME), it returns undefined because -0000001-12-31 is not a valid date!
Any help would be appreciated.
Regards.