This is a migrated thread and some comments may be shown as answers.

Bind DateTimePicker to DataTimeOffset attribute

3 Answers 91 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Hemal Shah
Top achievements
Rank 1
Hemal Shah asked on 04 Dec 2014, 06:56 PM
We have all our date fields in our Oracle DB defined as "Timestamp with Timezone". We use EF and LINQ to hydrate our VM from the DB. The VM gets populated correctly however when I try to bind a DateTimeOffset attribute to DateTimePicker component it fails.

Can you tell me what could I be doing incorrectly. If this is not supported does someone else have any suggestions that I can try.

Here is what I have so far 

VM
[DisplayName("Inactivate Date")]
public DateTimeOffset? inactivateDate { get; set; }

[DisplayName("Inactivate Date")]public DateTimeOffset? inactivateDate { get; set; }  
public DateTimeOffset? activateDate { get; set; }

[DisplayName("Energizing Date")]
public DateTimeOffset? energizingDate { get; set; }

View Template
<div class="form-group">
    @Html.LabelFor(model => model.energizingDate, new { @class = "control-label col-xs-2" })
    <div class="col-xs-2">
        @Html.EditorFor(model => model.energizingDate)
        @Html.ValidationMessageFor(model => model.energizingDate)
    </div>
    <div class="col-xs-3">
        <div class="form-group">
            @Html.LabelFor(model => model.activateDate, new { @class = "control-label col-xs-4" })
            <div class="col-xs-7">
                @Html.EditorFor(model => model.activateDate)
                @Html.ValidationMessageFor(model => model.activateDate)
            </div>
        </div>
    </div>
    <div class="col-xs-3">
        <div class="form-group">
            @Html.LabelFor(model => model.inactivateDate, new { @class = "control-label col-xs-4" })
            <div class="col-xs-7">
                @Html.EditorFor(model => model.inactivateDate)
                @Html.ValidationMessageFor(model => model.inactivateDate)
            </div>
        </div>
    </div>
</div>


DAO
var x = dao.CONNECTIVITY_UNIT
                        .Join(dao.OP_AREA_ORG, cu => cu.OP_AREA_CODE, oa => oa.OP_AREA_CODE, (cu, oa) => new { CONNECTIVITY_UNIT = cu, OP_AREA_ORG = oa })
                        .Where(w => w.CONNECTIVITY_UNIT.UNIT_TYPE.Equals("SUBSTATION"))
                        .Where(w => w.CONNECTIVITY_UNIT.IS_ACTIVE_FLAG.ToUpper().Equals("Y"))
                        .Where(w => w.CONNECTIVITY_UNIT.ABBR.ToUpper().Equals("BRA"))
                        .Select(c => new SubstationVM
                        {
                            connectivityUnitID = c.CONNECTIVITY_UNIT.CONNECTIVITY_UNIT_ID,
                            energizingDate = c.CONNECTIVITY_UNIT.ENERGIZING_DATE.Value.DateTime,
                            activateDate = c.CONNECTIVITY_UNIT.ACTIVATE_DATE.Value.DateTime,
                            //inactivateDate = c.CONNECTIVITY_UNIT.INACTIVATE_DATE.Value.DateTime,
                            updateTime = c.CONNECTIVITY_UNIT.UPDATE_TMSTMP
                        })
                        .OrderBy(o => o.substationABBR)
                        .ToList();


This fails when it has to find to the DateTimePicker component. I tried to bind it to plain old TextBox and it works fine.

What am I missing.

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 08 Dec 2014, 04:47 PM
Hello Hemal,

Sadly the DateTimeOffset type is still not supported by the Date/Time picker widgets of Kendo.

You need to first cast the type to DateTime.

Regards,
Petur Subev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Logan
Top achievements
Rank 1
Veteran
answered on 02 Jun 2017, 12:50 PM
Is it still the case the datetimeoffset is not supported in the date/time picker?
0
Stefan
Telerik team
answered on 06 Jun 2017, 07:17 AM
Hello Logan,

Unfortunately, the DataTimeOffset is still not implemented.

Still, I can suggest voting for it in our feedback portal as this will increase its changes to be implemented sooner:

http://kendoui-feedback.telerik.com/forums/127393-kendo-ui-feedback/suggestions/3842909-support-binding-of-datetimepicker-to-type-datetime

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
Tags
Date/Time Pickers
Asked by
Hemal Shah
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Logan
Top achievements
Rank 1
Veteran
Stefan
Telerik team
Share this question
or