Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
New Date() saves date 5 hours later
Message
 
 
To
All
General information
Forum:
Javascript
Category:
Other
Title:
New Date() saves date 5 hours later
Miscellaneous
Thread ID:
01618413
Message ID:
01618413
Views:
53
Hi everybody,

I have the following object
 $scope.transactionObject = {
                    accountNameHash: '',
                    operatorCode: userService.opCode.trim(),
                    salespoint: userService.salespoint,
                    message: '',
                    paymentType: 0,
                    transactionDate: new Date(),
                    invoicesToPay: []
                };
I can see (if I don't apply the date filter to display) that it shows GMT - 5 hours.

Anyway, when I try to save my data, the date is actually 5 hours later than my current date. I am not doing anything special except that I am using a directive with the following template:
@using Siriusware.Resources;

<h3 style="text-align:center;">{{metaData.title}}</h3>

<label class="control-label col-md-2" title="@Labels.operatorLabel">@Labels.operatorLabel:</label>

<div class="col-md-3">
    <select class="form-control" ng-model="transactionData.operatorCode"
            required
            name="operator" id="operator" data-no:dirty-check
            ng-options="t.opCode as t.opCode for t in metaData.operators"></select>
</div>

<label class="control-label col-md-2" title="@Labels.message">@Labels.message:</label>
<div class="col-md-5">
    <input type="text" name="message" id="message"
           ng-model="transactionData.message"
           class="form-control"
           data-no:dirty-check
           ng-maxlength="20" />
    <div class="field-validation-error">
        <span ng-show="formObject.message.$error.maxlength">@String.Format(Messages.cannotExceed, Labels.message, 20)</span>
    </div>
</div>

<label class="control-label col-md-2" title="@Labels.salespoint">@Labels.salespoint:</label>
<div class="col-md-3">
    <select class="form-control" ng-model="transactionData.salespoint" name="salespoint"
            id="salespoint" data-no:dirty-check required
            ng-options="t.salespoint as t.salespoint for t in metaData.salespoints"></select>
</div>

<label class="control-label col-md-2">@Labels.transactionDate:</label>
<div class="col-md-5">
    <data-sm:date-time-picker ng-model="transactionData.transactionDate"
                              is-date-range="false"
                              form="formObject"
                              placeholder="mm/dd/yy hh:mm:ss"
                              pick-time="true"
                              show-bod="true"
                              show-eod="true"
                              show-now="true"
                              name="transactionDate"
                              data-no:dirty-check
                              required>
    </data-sm:date-time-picker>
    <div class="field-validation-error">
        <span ng-show="formObject.transactionDate.$error.required">@String.Format(Messages.isRequired, Labels.transactionDate)</span>
    </div>
</div>
<div class="clearfix"></div>
I am going to check how other dates are saved in our application but do you see why would it add 5 extra hours to the date?

UPDATE. Tested in other places where we use the date time picker without extra directive and the date is saved 5 hours later as well. I think most likely the problem is in our date time picker directive.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform