Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Timing: different results when retrieving list of entities VS retrieving single entity #6190


User avatar
0
alexanderpilhar created

I encounter strange behaviour working with DateTime and Timing (Core/Angular, 6.4.0).

I use ClockProviders.Utc (set in CoreModule.cs). I can choose a Timezone for Host, Tenant and user profile, so i think Timing is configured correctly.

Current situation:

  • I have a model that has two properties of type DateTime (FromDateTime & ToDateTime).
  • Host, Tenant and user profile are all set to use timezone "Standard [UTC]".
  • When I create a new entity everything is fine: values in client-side logging are correct, as well as values stored in database.
  • When I retrieve a list of entities all is fine as well: values are correct.
  • But, when I retrieve a single entity in order to edit it, or copy an item from the list to create a new one based on the original (both opened in a modal window) the values are off by one hour (which is the current timezone offset between UTC and "Europe/Vienna", UTC+1). Also, on server side the values are still correct (AppService.cs).
  • In both cases (list of entities and single entity) _isAMomentObject, _isUTC and _isValid of the moment objects are true. _offset is -0, but not sure what the consequences are, if any.

Am I doing something wrong here? Am I missing something? Please, help!

BTW, I will be away for two weeks - so it will propably take some time till i can check out your advise and answer to your comments.

UPDATE #1 I will recreate the components in a clean project, just to see if there are any configuration issues in my project.

UPDATE #2 Recreated components: values (list of entities and single entity) are the same, so that's working correct. And there might be an issue with my create/edit-component.

BTW: ngx-bootstrap/datepicker does not work with moment.js yet ([github: #4826](https://github.com/valor-software/ngx-bootstrap/issues/4826)). In DemoUiDateTimeComponent usage of ngx-bootstrap/datepicker is demonstrated to select a date / date-range using moment.Moment / moment.Moment[] as data-type. At the moment, this works for selecting a date only and it will not work when the value gets set via code (invalid date).


No answer yet!