Convert Date() to a Different Time Zone Using JavaScript

Scenario User would like to get the current date in a different time zone using JavaScript. Solution In the following code snippet, currDate variable holds the current date and time in the given time zone: var toTimeZone=”+5:30″;var tz;if(toTimeZone.search(“:”)==-1){tz=parseFloat(toTimeZone);}else{tz=parseFloat(toTimeZone.slice(0,toTimeZone.search(“:”)))+parseFloat(toTimeZone.slice(toTimeZone.search(“:”)+1)/60)}var date = new Date();var utc = date.getTime() + (date.getTimezoneOffset() * 60000);var currDate = new Date(utc + (3600000*tz));currDate = currDate.toString();var currDate… Continue reading Convert Date() to a Different Time Zone Using JavaScript

How to create Customer Deposit from Sales Order using script

Creating customer Deposit automatically whenever a sales order is created. Note: If we create a sales order in currency other than the primary currency of the customer, by default the script will take the primary currency of the customer as the currency in customer deposit. This will throw an error while running the script. That… Continue reading How to create Customer Deposit from Sales Order using script

Add a New Module to the Checkout with the Extensibility API

Understanding the Checkout Wizard If you want to make changes to your checkout, it’s good to try and figure out if it can be achieved through configuration (including the web site setup tool) and theming, as these will be the easiest and safest ways to make changes. The Wizard In SC the majority of the… Continue reading Add a New Module to the Checkout with the Extensibility API

CSS Layout – Horizontal & Vertical Align

Center Align Elements To horizontally center a block element (like <div>), use margin: auto; Setting the width of the element will prevent it from stretching out to the edges of its container. The element will then take up the specified width, and the remaining space will be split equally between the two margins: Center Align Text… Continue reading CSS Layout – Horizontal & Vertical Align

Accounting Period close and Quick close feature

Permissions related to Accounting Period management Prior to accessing accounting period management, relevant permissions need to be assigned to the Roles.   Edit or Full level of the Manage Accounting Periods permission is required to set up, edit, lock transactions for the period close, or reopen accounting periods. Users with the View level of this permission can see the Manage Accounting Periods page… Continue reading Accounting Period close and Quick close feature

How to resolve the SyntaxError: “use strict” occured in Java Script

The JavaScript exception “’use strict’ not allowed in function” occurs when a “use strict” directive is used at the top of a function with default parameters, rest parameters, or destructing parameters. Error: SyntaxError: Illegal ‘use strict’ directive in function with non-simple parameter list (V8-based) SyntaxError: “use strict” not allowed in function with default parameter (Firefox) SyntaxError: “use strict” not… Continue reading How to resolve the SyntaxError: “use strict” occured in Java Script