diff --git a/ej2-asp-core-mvc/code-snippet/datepicker/timezone-cs1/razor b/ej2-asp-core-mvc/code-snippet/datepicker/timezone-cs1/razor new file mode 100644 index 0000000000..7c643cd891 --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/datepicker/timezone-cs1/razor @@ -0,0 +1,9 @@ +@{ + var serverTimezoneOffset = 5.5; + var initialDate = new Date(); +} + +@Html.EJS().DatePicker("datepicker") + .ServerTimezoneOffset(serverTimezoneOffset) + .Value(initialDate) + .Render() diff --git a/ej2-asp-core-mvc/code-snippet/datepicker/timezone-cs1/tagHelper b/ej2-asp-core-mvc/code-snippet/datepicker/timezone-cs1/tagHelper new file mode 100644 index 0000000000..79f54501f7 --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/datepicker/timezone-cs1/tagHelper @@ -0,0 +1,7 @@ + +@{ + var serverTimezoneOffset = 5.5; + var initialDate = new Date(); +} + + \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/datepicker/timezone-cs1/timezone.cs b/ej2-asp-core-mvc/code-snippet/datepicker/timezone-cs1/timezone.cs new file mode 100644 index 0000000000..a4db34d06a --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/datepicker/timezone-cs1/timezone.cs @@ -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(); + } + } +} diff --git a/ej2-asp-core-mvc/code-snippet/datetimepicker/timezone-cs1/razor b/ej2-asp-core-mvc/code-snippet/datetimepicker/timezone-cs1/razor new file mode 100644 index 0000000000..0de998bc68 --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/datetimepicker/timezone-cs1/razor @@ -0,0 +1,9 @@ +@{ + var serverTimezoneOffset = 5.5; + var initialDate = new Date(); +} + +@Html.EJS().DateTimePicker("datetimepicker") + .ServerTimezoneOffset(serverTimezoneOffset) + .Value(initialDate) + .Render() diff --git a/ej2-asp-core-mvc/code-snippet/datetimepicker/timezone-cs1/tagHelper b/ej2-asp-core-mvc/code-snippet/datetimepicker/timezone-cs1/tagHelper new file mode 100644 index 0000000000..79f54501f7 --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/datetimepicker/timezone-cs1/tagHelper @@ -0,0 +1,7 @@ + +@{ + var serverTimezoneOffset = 5.5; + var initialDate = new Date(); +} + + \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/datetimepicker/timezone-cs1/timezone.cs b/ej2-asp-core-mvc/code-snippet/datetimepicker/timezone-cs1/timezone.cs new file mode 100644 index 0000000000..789ffb657a --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/datetimepicker/timezone-cs1/timezone.cs @@ -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(); + } + } +} diff --git a/ej2-asp-core-mvc/datepicker/EJ2_ASP.MVC/timezone-behavior.md b/ej2-asp-core-mvc/datepicker/EJ2_ASP.MVC/timezone-behavior.md index 9effedceeb..4618644478 100644 --- a/ej2-asp-core-mvc/datepicker/EJ2_ASP.MVC/timezone-behavior.md +++ b/ej2-asp-core-mvc/datepicker/EJ2_ASP.MVC/timezone-behavior.md @@ -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 %} diff --git a/ej2-asp-core-mvc/datepicker/EJ2_ASP.NETCORE/timezone-behavior.md b/ej2-asp-core-mvc/datepicker/EJ2_ASP.NETCORE/timezone-behavior.md index 9effedceeb..6f4b91bf19 100644 --- a/ej2-asp-core-mvc/datepicker/EJ2_ASP.NETCORE/timezone-behavior.md +++ b/ej2-asp-core-mvc/datepicker/EJ2_ASP.NETCORE/timezone-behavior.md @@ -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 %} diff --git a/ej2-asp-core-mvc/datetimepicker/EJ2_ASP.MVC/timezone-behavior.md b/ej2-asp-core-mvc/datetimepicker/EJ2_ASP.MVC/timezone-behavior.md index e41385de28..bf90458835 100644 --- a/ej2-asp-core-mvc/datetimepicker/EJ2_ASP.MVC/timezone-behavior.md +++ b/ej2-asp-core-mvc/datetimepicker/EJ2_ASP.MVC/timezone-behavior.md @@ -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. @@ -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 %} diff --git a/ej2-asp-core-mvc/datetimepicker/EJ2_ASP.NETCORE/timezone-behavior.md b/ej2-asp-core-mvc/datetimepicker/EJ2_ASP.NETCORE/timezone-behavior.md index 0dd0647856..8eca3b6317 100644 --- a/ej2-asp-core-mvc/datetimepicker/EJ2_ASP.NETCORE/timezone-behavior.md +++ b/ej2-asp-core-mvc/datetimepicker/EJ2_ASP.NETCORE/timezone-behavior.md @@ -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'); \ No newline at end of file +{% 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 %} \ No newline at end of file diff --git a/ej2-asp-core-toc.html b/ej2-asp-core-toc.html index ccb3f70cdb..6b0fb36921 100644 --- a/ej2-asp-core-toc.html +++ b/ej2-asp-core-toc.html @@ -788,6 +788,7 @@
  • Start and Depth View
  • Accessibility
  • Style and Appearance
  • +
  • Timezone Behavior
  • How To