Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ej2-asp-core-mvc/code-snippet/datepicker/timezone-cs1/razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@{
var serverTimezoneOffset = 5.5;
var initialDate = new Date();
}

@Html.EJS().DatePicker("datepicker")
.ServerTimezoneOffset(serverTimezoneOffset)
.Value(initialDate)
.Render()
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

@{
var serverTimezoneOffset = 5.5;
var initialDate = new Date();
}

<ejs-datetimepicker id="datetimepicker" value="intialDate" serverOffset="serverTimezoneOffset"></ejs-datetimepicker>
18 changes: 18 additions & 0 deletions ej2-asp-core-mvc/code-snippet/datepicker/timezone-cs1/timezone.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace EJ2CoreSampleBrowser.Controllers
{
public class HomeController : Controller
{
public ActionResult Datepicker()
{
ViewBag.serverTimezoneOffset=5.5;
ViewBag.initalDate=new Date();
return View();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@{
var serverTimezoneOffset = 5.5;
var initialDate = new Date();
}

@Html.EJS().DateTimePicker("datetimepicker")
.ServerTimezoneOffset(serverTimezoneOffset)
.Value(initialDate)
.Render()
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

@{
var serverTimezoneOffset = 5.5;
var initialDate = new Date();
}

<ejs-datetimepicker id="datetimepicker" value="intialDate" serverOffset="serverTimezoneOffset"></ejs-datetimepicker>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace EJ2CoreSampleBrowser.Controllers
{
public class HomeController : Controller
{
public ActionResult DateTimepicker()
{
ViewBag.serverTimezoneOffset=5.5;
ViewBag.initalDate=new Date();
return View();
}
}
}
31 changes: 18 additions & 13 deletions ej2-asp-core-mvc/datepicker/EJ2_ASP.MVC/timezone-behavior.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,21 @@ The `serverTimezoneOffset` property allows you to specify the server's time zone

N> The `serverTimezoneOffset` property is applicable **only for pre-bound values** (i.e., values set during initialization or data binding). It does **not affect** values selected by the user during runtime.

### Example

```ts
import { DatePicker } from '@syncfusion/ej2-calendars';

/* Initialize the DatePicker component */
let datepicker: DatePicker = new DatePicker({
placeholder: "Select Date",
width: "250px",
serverTimezoneOffset: 5.5 // Example: UTC+5:30 for IST
});

datepicker.appendTo('#datepicker');
{% if page.publishingplatform == "aspnet-core" %}

{% tabs %}
{% highlight cshtml tabtitle="CSHTML" %}
{% include code-snippet/datepicker/timezone-cs1/tagHelper %}
{% endhighlight %}
{% highlight c# tabtitle="timezone.cs" %}
{% endhighlight %}{% endtabs %}

{% elsif page.publishingplatform == "aspnet-mvc" %}

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/datepicker/timezone-cs1/razor %}
{% endhighlight %}
{% highlight c# tabtitle="timezone.cs" %}
{% endhighlight %}{% endtabs %}
{% endif %}
29 changes: 18 additions & 11 deletions ej2-asp-core-mvc/datepicker/EJ2_ASP.NETCORE/timezone-behavior.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,21 @@ N> The `serverTimezoneOffset` property is applicable **only for pre-bound values

### Example

```ts
import { DatePicker } from '@syncfusion/ej2-calendars';

/* Initialize the DatePicker component */
let datepicker: DatePicker = new DatePicker({
placeholder: "Select Date",
width: "250px",
serverTimezoneOffset: 5.5 // Example: UTC+5:30 for IST
});

datepicker.appendTo('#datepicker');
{% if page.publishingplatform == "aspnet-core" %}

{% tabs %}
{% highlight cshtml tabtitle="CSHTML" %}
{% include code-snippet/datepicker/timezone-cs1/tagHelper %}
{% endhighlight %}
{% highlight c# tabtitle="timezone.cs" %}
{% endhighlight %}{% endtabs %}

{% elsif page.publishingplatform == "aspnet-mvc" %}

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/datepicker/timezone-cs1/razor %}
{% endhighlight %}
{% highlight c# tabtitle="timezone.cs" %}
{% endhighlight %}{% endtabs %}
{% endif %}
27 changes: 17 additions & 10 deletions ej2-asp-core-mvc/datetimepicker/EJ2_ASP.MVC/timezone-behavior.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The DateTimePicker component displays and maintains the selected date and time v

N> if the system time zone is changed dynamically after a value is selected, the DateTimePicker will **not update or shift** the selected value. The component preserves the original selection, ensuring a stable and reliable user experience.

## `serverTimezoneOffset`
## serverTimezoneOffset

The `serverTimezoneOffset` property allows you to specify the server's time zone offset from UTC in **hours** or **fractional hours**. This is useful when binding values from the server to ensure they are interpreted correctly on the client side.

Expand All @@ -28,14 +28,21 @@ N> The `serverTimezoneOffset` property is applicable **only for pre-bound values

### Example

```ts
import { DateTimePicker } from '@syncfusion/ej2-calendars';
{% if page.publishingplatform == "aspnet-core" %}

/* Initialize the DateTimePicker component */
let datetimepicker: DateTimePicker = new DateTimePicker({
placeholder: "Select Date Time",
width: "250px",
serverTimezoneOffset: 5.5 // Example: UTC+5:30 for IST
});
{% tabs %}
{% highlight cshtml tabtitle="CSHTML" %}
{% include code-snippet/datetimepicker/timezone-cs1/tagHelper %}
{% endhighlight %}
{% highlight c# tabtitle="timezone.cs" %}
{% endhighlight %}{% endtabs %}

datetimepicker.appendTo('#datetimepicker');
{% elsif page.publishingplatform == "aspnet-mvc" %}

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/datetimepicker/timezone-cs1/razor %}
{% endhighlight %}
{% highlight c# tabtitle="timezone.cs" %}
{% endhighlight %}{% endtabs %}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,21 @@ N> The `serverTimezoneOffset` property is applicable **only for pre-bound values

### Example

```ts
import { DateTimePicker } from '@syncfusion/ej2-calendars';

/* Initialize the DateTimePicker component */
let datetimepicker: DateTimePicker = new DateTimePicker({
placeholder: "Select Date Time",
width: "250px",
serverTimezoneOffset: 5.5 // Example: UTC+5:30 for IST
});

datetimepicker.appendTo('#datetimepicker');
{% if page.publishingplatform == "aspnet-core" %}

{% tabs %}
{% highlight cshtml tabtitle="CSHTML" %}
{% include code-snippet/datetimepicker/timezone-cs1/tagHelper %}
{% endhighlight %}
{% highlight c# tabtitle="timezone.cs" %}
{% endhighlight %}{% endtabs %}

{% elsif page.publishingplatform == "aspnet-mvc" %}

{% tabs %}
{% highlight razor tabtitle="CSHTML" %}
{% include code-snippet/datetimepicker/timezone-cs1/razor %}
{% endhighlight %}
{% highlight c# tabtitle="timezone.cs" %}
{% endhighlight %}{% endtabs %}
{% endif %}
2 changes: 2 additions & 0 deletions ej2-asp-core-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,7 @@
<li><a href="/ej2-asp-core/datepicker/view">Start and Depth View</a></li>
<li><a href="/ej2-asp-core/datepicker/accessibility">Accessibility</a></li>
<li><a href="/ej2-asp-core/datepicker/style-appearance">Style and Appearance</a></li>
<li><a href="/ej2-asp-core/datepicker/timezone-behavior">Timezone Behavior</a></li>
<li>How To
<ul>
<li><a href="/ej2-asp-core/datepicker/how-to/disabled-the-datepicker-component">Disabled the DatePicker Component</a></li>
Expand Down Expand Up @@ -844,6 +845,7 @@
<li><a href="/ej2-asp-core/datetimepicker/globalization">Globalization</a></li>
<li><a href="/ej2-asp-core/datetimepicker/accessibility">Accessibility</a></li>
<li><a href="/ej2-asp-core/datetimepicker/style-appearance">Style and Appearance</a></li>
<li><a href="/ej2-asp-core/datetimepicker/timezone-behavior">Timezone Behavior</a></li>
<li>How To
<ul>
<li><a href="/ej2-asp-core/datetimepicker/how-to/disable-the-datetimepicker-component">Disable the DateTimePicker Component</a></li>
Expand Down
2 changes: 2 additions & 0 deletions ej2-asp-mvc-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,7 @@
<li><a href="/ej2-asp-mvc/datepicker/view">Start and Depth View</a></li>
<li><a href="/ej2-asp-mvc/datepicker/accessibility">Accessibility</a></li>
<li><a href="/ej2-asp-mvc/datepicker/style-appearance">Style and Appearance</a></li>
<li><a href="/ej2-asp-mvc/datepicker/timezone-behavior">Timezone Behavior</a></li>
<li>How To
<ul>
<li><a href="/ej2-asp-mvc/datepicker/how-to/disabled-the-datepicker-component">Disabled the DatePicker Component</a></li>
Expand Down Expand Up @@ -794,6 +795,7 @@
<li><a href="/ej2-asp-mvc/datetimepicker/globalization">Globalization</a></li>
<li><a href="/ej2-asp-mvc/datetimepicker/accessibility">Accessibility</a></li>
<li><a href="/ej2-asp-mvc/datetimepicker/style-appearance">Style and Appearance</a></li>
<li><a href="/ej2-asp-mvc/datetimepicker/timezone-behavior">Timezone Behavior</a></li>
<li>How To
<ul>
<li><a href="/ej2-asp-mvc/datetimepicker/how-to/disable-the-datetimepicker-component">Disable the DateTimePicker Component</a></li>
Expand Down