Telerik Forums
Kendo UI for jQuery Forum
2 answers
10.6K+ views
Hi all,

I am building a web application that collects information about emergency drills, such as evacuation drills, tornado drills, etc. As you could imagine recording what time the drill was conducted is extremely important.

Well, the Kendo DateTime pickers are adding the timezone offset to the time value when the value is sent to the server. Receiving from the server works fine. 

Everybody that is using my web application is in eastern time zone, no exceptions. The timezone is GMT-5 currently. Let's use an example: a user submits a drill for 12/04/2014 1:00 PM. The time gets sent to the server but the timezone affects the time, so it will be stored in the database as 12/04/2014 6:00 PM. The timezone adds 5 hours when sent to the server. When we are in daylight savings time we are GMT-4 and 4 hours are added to the time. When my app requests the information from the server it works fine. If the server sends back 12/04/2014 1:00 PM it will display as such on the web page.

My current fix it to subtract 5 hours from the time before it is sent to the server. I don't like that because every time we go through day light savings time I have to update my code back and forth between 4 hours and 5 hours. I guess I could find the time zone from the time string and subtract whatever it is currently, but I don't like that. How can I fix this?

Thanks
Darron
Top achievements
Rank 1
Iron
 answered on 14 May 2025
1 answer
60 views

below is the code of popup and javascript function

 <!-- #region  Vaibhav Updated Bootstrap 5.3.3 * -->
 <!-- DatePicker Text Modal -->
 <div class="modal fade" id="DatePickerZoneModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="DatePickerZoneModalLabel" aria-hidden="true">
     <div class="modal-dialog modal-sm" style="min-width: 375px;">
         <div class="modal-content">
             <div class="modal-header">
                 <h6 class="modal-title">
                     @Localizer["lblSelectDate"]
                     <span class="lblDate fst-italic" style="color:lightgray;"></span>
                 </h6>
                 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
             </div>
             <div class="modal-body" style="height: 120px; padding: 2.5rem;">
                 <div id="dvdatezone">
                     <span class="spnmandatory hide" style="color: red; font-weight: bold; font-size: 18px;">*</span>
                     <label style="float:left; margin-right: 10px; margin-top: 5px;">Date : </label>
                     <input type="text" id="txtDatePicker">
                 </div>
                 <label id="lblmsg" style="color:red; margin: 0.5rem 4rem; font-size:15px;"></label>
                 <span data-for="myDatePicker" class="k-invalid-msg"></span>
             </div>
             <div class="modal-footer">
                 <button type="button" id="btnDateSave" class="btn btn-default btnCreate" onclick="return UpdateDate();">
                     <i id="innericon" class="fal fa-check-circle"></i>
                     <span id="innerdiv">@Localizer["lblSavechanges"]</span>
                 </button>
                 <button type="button" class="btn btn-default btnCancel" data-bs-dismiss="modal">
                     <i id="innericon" class="fal fa-ban"></i>
                     <span id="innerdiv">@Localizer["lblClose"]</span>
                 </button>
             </div>
         </div>
     </div>
 </div>


// Vaibhav UpdateDate Code for Bootstrap 5.3.3

 function UpdateDate() {
    var $txtDatePicker = $("#txtDatePicker");
    var editor = $("#txtDatePicker").val();
    var textZoneId = $("#hdnTextZoneId").val();
    var index = textZoneId.split("_");
    var frShowDocs = $frShowDocs[0].contentWindow;
    var commmentDivtext = frShowDocs.document.getElementById(textZoneId);
    var plainText = editor.replace(/<[^>]*>/g, "");
    var cnt = 0;
    if (frShowDocs.objTxtZoneArray[index[1]] != undefined) {
        cnt = 1;
    } else {
        cnt = 0;
    }

    //Asingh: first replace <br /> to "!!_!!"
    var outputText = plainText.replace(/<br\s*[\/]?>/gi, '!!_!!');
    outputText = outputText.replace(/!!_!!/gi, '\n');
    console.log('outputText : ' + outputText);
    commmentDivtext.innerText = outputText;

    jsonInputInfos.TextZones[index[cnt]].RTFTXT = outputText; //<<<ben: To see: should be not html encoded, at the moment if a "é" is here it's saved as "&eacute; in the db ...
    jsonInputInfos.TextZones[index[cnt]].RTFTXTDECODE = outputText;

    //Prab Fix: Client got enccoded french text
    frShowDocs.objTxtZoneArray[index[cnt]].lastValue = outputText;
    frShowDocs.objTxtZoneArray[index[cnt]].isUpdated = true;

    var validator = $txtDatePicker.data("kendoValidator");
    if (!validator.validate()) {
        return false;
    }

    $("#DatePickerZoneModal").modal('hide');
    return false;
}

// $("#txtDatePicker").on("focus", function () {
//     var dp = $(this).data("kendoDatePicker");
//     if (dp) dp.open();
// });

function DateZoneModal(clickedDivId, isMandatoryflag) {
    if (isMandatoryflag)
        $(".spnmandatory").removeClass("hide");
    $("#btnDateSave").attr('disabled', false);
    var $hdnTextZoneId = $("#hdnTextZoneId");
    $hdnTextZoneId.val(clickedDivId.id);
    var textZoneId = $hdnTextZoneId.val();
    var index = textZoneId.split("_");
    $("#lblmsg").text(' ');
    //read iframe elemnt
    var frShowDocs = $frShowDocs[0].contentWindow;

    currentHighlightZone = parseInt(clickedDivId.dataset.highlightid);
    frShowDocs.DisplayArrow(currentHighlightZone, true, false);

    var commmentDivtext = frShowDocs.document.getElementById(clickedDivId.id);
    var zoneText = commmentDivtext.innerText;

    zoneText = zoneText.replace(/\n/g, "!!_!!");
    zoneText = zoneText.replace(/!!_!!/g, "<br />");
    console.log(clickedDivId.dataset.dateformat);

    var $txtDatePicker = $("#txtDatePicker");
    var $DatePickerZoneModal = $("#DatePickerZoneModal");

   // 1. Destroy previous DatePicker instance (if exists)
    if ($txtDatePicker.data("kendoDatePicker")) {
        $txtDatePicker.data("kendoDatePicker").destroy();
        $txtDatePicker.unwrap(); // Removes Kendo's wrapper (important to avoid offset errors)
       // $txtDatePicker = $('<input type="text" id="txtDatePicker" />'); // Recreate input
    }
    setTimeout(function () {
        $txtDatePicker.kendoDatePicker({
            dateInput: true,
            validation: { required: true },
            format: clickedDivId.dataset.dateformat,
        });
    }, 100); // delay ensures modal is fully rendered
  

    $txtDatePicker.kendoValidator({
        rules: {
            dateValidation: function (input) {
                if (input.is('[data-role="datepicker"]')) {
                    var value = $(input).val();
                    var dformat = $(input).attr("data-dateformat");
                    var date = kendo.parseDate(value, dformat);

                    if (value == "" || !date) {
                        $("#btnDateSave").attr('disabled', 'disabled');
                        $("#lblmsg").text(txtdatevalidmsg);
                        $(input).val('');
                        return false;
                    }
                    else {
                        $("#btnDateSave").attr('disabled', false);
                        $("#lblmsg").text(' ');
                        return true;
                    }
                }
                return true;
            }
        },
        messages: {
            dateValidation: txtdatevalidmsg
        }
    });

    $txtDatePicker.val(zoneText);
    $txtDatePicker.attr("data-dateformat", clickedDivId.dataset.dateformat);
    $txtDatePicker.attr('placeholder', clickedDivId.dataset.dateformat.toUpperCase());
    $DatePickerZoneModal.find('.lblDate').text('(' + clickedDivId.dataset.dateformat.toUpperCase() + ')');
    $('.k-datepicker').attr('style', 'width:initial;');
    // $("#lblmsg").text(' ');
    //$("#btnDateSave").attr('disabled', false);
    $DatePickerZoneModal.modal('show');
}



2 answers
61 views

The modal isn't very large, so the calendar popup shows outside the modal.

When selecting a day or month, the date picker is updated and the modal remains open.
When selecting a year, the modal closes. 

As though the mouse click gets passed to the page.

Kendo: 2024.1.319

Peter
Top achievements
Rank 1
Iron
 answered on 24 Jan 2025
0 answers
95 views

Hi,

I am attempting to update our current version of Kenduo UI for Jquery from 2023.1.117 to 2024.4.1112.

I have downloaded the commercial release zip and have updated the references to the js and css files (as I have done with previous upgrades), however I am experiencing lots of styling issues for font sizes and layout across inputs ans widgets.

Firstly, the text size is much smaller for inputs and widgets.

The display of widgets on different browsers is inconsistent (for example the calendar widget is being cut off on FireFox, but is spanning the whole screen on Chrome - screenshots attached).

Any ideas what could be causing this?

Icon
Top achievements
Rank 1
 asked on 23 Dec 2024
1 answer
236 views

Hi,

I am trying to use the Kendo UI kendoDatePicker but I am not seeing the button that opens up the calendar? Must be missing something? Here is what I am using:


    <link rel="stylesheet" href="lib/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="css/site.css" asp-append-version="true" />
    <link rel="stylesheet" href="Kendo/2023.3.1010/styles/bootstrap-3.css" />
    <link rel="stylesheet" href="Kendo/2023.3.1010/styles/bootstrap-main.css" />
    <link rel="stylesheet" href="FontAwesome/font-awesome-4.7.0/css/font-awesome.min.css" />
    <link rel="stylesheet" href="styles/jquery_1.12.0-rc2/jquery-ui.min.css" />
    
    <!-- JAVASCRIPT -->
    <script type="text/javascript" src="jQuery/jquery-2.2.4.min.js"></script>
    <script type="text/javascript" src="Kendo/2023.3.1010/js/jszip.min.js"></script>
    <script type="text/javascript" src="Kendo/2023.3.1010/js/kendo.all.min.js"></script>
    <script type="text/javascript" src="Kendo/2023.3.1010/js/kendo.timezones.min.js"></script>
    <script type="text/javascript" src="scripts/jquery-ui.min.js"></script>

Here is the code in my JavaScript file:

    $("#startDate").kendoDatePicker({
        value: _view.get("startDate"),
        change: function () {
            var value = this.value();
            var submitVal = kendo.toString(value, "yyyy-MM-dd");
            /* The result can be observed in the DevTools(F12) console of the browser. */
            console.log("START DATE: " + value + " AFTER kendo.toString: " + submitVal); //value is the selected date in the datepicker
        }
    });

I am just getting the field with the date inside of it now, no calendar selection button:

Here is a screen shot of my HTML code:


Thanks! 

George

Nikolay
Telerik team
 answered on 30 Oct 2024
0 answers
113 views

I am running into an issue with allowing copy/paste of dates into the filter and cell input fields. Currently, the date fields have validation to support MM/dd/yyyy, and users of the app may be trying to copy dates in that are MM/dd/yy. I would expect Kendo to auto format the date to MM/dd/yyyy after the paste happens, or at least allow support for that, but it doesn't seem to happen.

In the cell, when putting in MM/dd/yy, a validation message appears saying the date is invalid, and there doesn't appear to be a way to override that. In the filter, when putting in MM/dd/yy and submitting the filter, it doesn't stick and completely ignores the date put in.

Is there any way with the latest version of Kendo (I am on 16) to allow for different date formats in these fields, or is there the possibility that this is something coming in the future?

1 answer
123 views

I want some of my date time pickers to have a width of 140px.

 https://dojo.telerik.com/@mortenma71/eSAhOyaN/9

It works when I set the width using inline style:
<input id="datepicker" value="10/10/2011" style="width:140px;" />

It doesn't work when I set the width using a CSS class.

Without !important the CSS class seem to have no effect:
<style>.width-140 { width: 140px; }</style>
<input id="datepicker2" value="10/10/2011" class="width-140" />

With !important the CSS class effects the width, however the svg-picker-icon doesn't show:
<style>.width-140-important { width: 140px !important; }</style>
<input id="datepicker3" value="10/10/2011" class="width-140-important" />

I only observed the problem now; I'm sure it worked in an earlier kendo/CSS version.

How can I set the width using a CSS class and retain the svg-picker icon?

/Morten

Martin
Telerik team
 answered on 14 Aug 2024
1 answer
114 views

I am trying to fix an issue on an old react application with jquery dependencies and I am not familiar with the approach used here. We are using the following dependencies(some important ones mentioned). Node version is 14.x

"dependencies": {
"@progress/kendo-ui": "^2021.3.1207",
"@types/node": "^12.20.15",
"@types/react": "^17.0.11",
"moment": "^2.29.4",
"react": "^17.0.2",
.
.
.
}

  "devDependencies": {
    "@types/jquery": "^3.5.5",
.
.
.
  }


Right now we are using the below timepicker and this passes in a datetime value on save, in this format 2024-03-14T09:00:00.000Z. But I want to change this to pass in value as a time in this format HH:mm:ss . 

      <input
        id={this.id}
        name={this.props.validationName}
        data-role="timepicker"
        data-bind={`value: ${ValueCodes.Start}`}
        data-format="h:mm tt"
        required={true}
        disabled={true}
      />

I understand that the ValueCodes.Start mentioned above is linked with the type of the input filed. I did find the following set of codes that determine the type of that field in the corresponding datasource builder file.

export class ValueCodes {
  public static readonly Start = 'sTRT_TIME';
.
.
.
}

protected getDataSourceOptions() {
    const fields: { [key: string]: { type: string } } = {};
    switch (this.categoryCode) {
      case 'INIT':
        fields[ValueCodes.Start] = { type: 'date' };
.
.
.
        break;
.
.
.
      default:
        break;
    }
    return {
      fields: fields,
      transportOptions: { baseUrl: `${X.getApiUrl()}value/${this.categoryCode}` }
    };
  }
}

On changing the 'type' from 'date' to 'time' here, fields[ValueCodes.Start] = { type: 'date' }; I encountered some errors. I was only able to save the value in my desired format, if I disable validation. Aprart from that the timepicker now will not load the datetime or time value fetched from the backend because of the 'type' change from 'date' to 'time'.

Is there a specific way in kendo that I can try to overcome this?

Neli
Telerik team
 answered on 19 Mar 2024
1 answer
78 views

This is a follow-up to my original question:

I have a Kendo Date Picker for AngualrJS and I would like to color the individual day cells for a given day within the month.

https://www.telerik.com/forums/angualrjs-kendo-date-picker-how-to-color-day-cells

The follow-up question is:

I see that you can tie a colour background to a particular day value within a month, but how would you do that to a specific date (i.e. Make only the 10th of January red, but not the 10th of February, for example)?

Neli
Telerik team
 answered on 06 Feb 2024
0 answers
88 views
Hi there!
   i have been using a modern kendo datetimepicker in my project. where i got the requirement from the user which while selecting the date value   in datetimepicker component its automatically navigating to the time page.  Is there any way to restrict those behaviour and makes the component close while changing the date alone.


Kindly find the attached image for more clarity about the case.
GOVERTHANAN
Top achievements
Rank 1
Iron
 asked on 20 Dec 2023
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Map
Drag and Drop
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
SPA
Filter
Drawer (Mobile)
Drawing API
Globalization
Gauges
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
MultiColumnComboBox
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
OrgChart
TextBox
Effects
Accessibility
ScrollView
PivotGridV2
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Collapsible
Localization
MultiViewCalendar
Touch
Breadcrumb
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
Popover
DockManager
FloatingActionButton
TaskBoard
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?