New release: 4.2 with date strings, moment.js and typescript support

Great news, we have a new version out with great productivity improvements. Let’s see what’s new.

Making the work with dates dead simple

We built on top of javascript date objects from the beginning. Passing data and getting data from mobiscroll was all working with date objects. Which was ok back then, however not everyone uses date objects today. Up to 4.2 if you were working with any other format you’d have to convert it into a js date object and then back again. It was an additional step in the process requiring a couple of lines of code. The support for ISO 8601 strings for date, time and datetime with or without localization is here!

Besides that, built-in support for moment.js was added as well. You can now pass the dates in the format you prefer and use the returnFormat option to tell Mobiscroll how you’d like to get the data back. Check out these examples for the date picker and calendar.

This change is applicable to the Date & Time, Calendar, Range and Event Calendar components. It’s not just the selected value and defaults but every property that is a date or a collection of dates, like min, max, invalids, startDate, endDate and so on.

Type definitions

Typescript is loved by a lot of developers. It brings the the power on convenience of typed languages to Javascript and with the rise of editors like Visual Studio Code in the front-end community it gives an edge to people when it comes to writing code.

Because we’re all about giving superpowers to developers, happy to share the type definitions for Javascript and jQuery. When downloading the latest version you’ll see the additional .d.ts files. Make sure to follow these guides if you are using typescript with jQuery or Javascript.

Snackbar & toast

We’ve added positioning and color support to the snackbar and toast controls. Render them at the top or bottom of the page and use the color presets that are available across Mobiscroll.

For everything that changed take a look at the changelog. As always, this release is available for download to all customers who have an active maintenance. You can also update through NPM if that is how you get your libraries.

Start building better products
Sign up and get posts like this in your inbox. We respect your time and will send you only the good stuff!