The SDK for Star Insure client apps with shared helper functions and TypeScript definitions.
npm install @star-insure/sdk
npm start
npm run test
Suggest that you use np for publishing.
From the command line just run (you'll need Node version 18+ running):
npm run publish
This library provides the following functions:
- formatDate - Returns a string in format dd/mm/yyyy
import { formatDate } from '@star-insure/sdk';
formatDate(new Date());
formatDate('2024-03-23T20:00:00.000Z');
formatDate('Sat, 23 Mar 2024 20:00:00 GMT');
- formatDateTime - Returns a string in format dd/mm/yyyy hh:mm (24-hour clock)
import { formatDateTime } from '@star-insure/sdk';
formatDateTime(new Date());
formatDateTime('2024-03-23T20:00:00.000Z');
formatDateTime('Sat, 23 Mar 2024 20:00:00 GMT');
- formatMoney - Returns a string in format $x,xxx.xx
import { formatMoney } from '@star-insure/sdk';
formatMoney(1234567.89);
formatMoney('1234567.89');