How to deal with timezone using Magelia WebStore for Orchard ?

Mar 9, 2015 at 2:31 PM
One of our customers asked us how to configure timezone in Magelia WebStore in order to use the Magelia WebStore module for Orchard.

Please find hereafter our answer.

Magelia Customer Care
Mar 9, 2015 at 2:39 PM
Hi,

Regarding the time zone you are using when you edit data in the administration console, you can set the appropriate one in the user profile properties :

Image

Once your profile updated all dates will be saved according to your profile time zone (all dates are saved using the DateTimeOffset .Net type).

On the Orchard side, as you can see for instance in the Product.cshtml view, you can use the following method to display dates according to the orchard default time zone : TimeZoneInfo.ConvertTime(datetimevalue, this.WorkContext.CurrentTimeZone).ToString("G").

Orchard workcontext timezone is configured in the settings panel :

Image

Please note that the Magelia WebStore module for Orchard already use this statement to render dates in the product widget, the products list widget, the orders widget etc ...

Do not hesitate to contact us if you have any further questions.

Best regards,
Aloys GAUTHEY