2023-07-12 09:28:52 +00:00
|
|
|
import { expect, tap } from '@push.rocks/tapbundle';
|
2018-10-16 23:42:36 +00:00
|
|
|
|
2022-11-21 08:14:32 +00:00
|
|
|
import * as smarttime from '../ts/index.js';
|
2018-10-16 23:42:36 +00:00
|
|
|
|
2021-10-06 09:58:36 +00:00
|
|
|
tap.test('should create a valid JavaScript Date', async () => {
|
|
|
|
const extendedDate = new smarttime.ExtendedDate(Date.now());
|
|
|
|
console.log(extendedDate);
|
|
|
|
});
|
|
|
|
|
2018-10-16 23:42:36 +00:00
|
|
|
tap.test('should create a valid JavaScript Date from European TimeStamp', async () => {
|
2018-10-21 15:23:58 +00:00
|
|
|
const extendedDate = smarttime.ExtendedDate.fromEuropeanDate('1.6.2018');
|
2018-10-16 23:42:36 +00:00
|
|
|
console.log(extendedDate);
|
|
|
|
});
|
|
|
|
|
2018-10-21 10:12:44 +00:00
|
|
|
tap.test('should create a date and time with European Format', async () => {
|
2018-11-23 17:29:38 +00:00
|
|
|
const extendedDate = smarttime.ExtendedDate.fromEuropeanDateAndTime(
|
|
|
|
'9.8.2018',
|
|
|
|
'08:00:00',
|
|
|
|
'Europe/Berlin'
|
|
|
|
);
|
2018-10-21 10:12:44 +00:00
|
|
|
console.log(extendedDate);
|
2018-11-23 17:29:38 +00:00
|
|
|
});
|
2018-10-21 10:12:44 +00:00
|
|
|
|
2019-06-18 12:38:57 +00:00
|
|
|
tap.test('should create a European date string', async () => {
|
|
|
|
const extendedDate = smarttime.ExtendedDate.fromHyphedDate('2018-02-13');
|
2022-02-02 15:55:12 +00:00
|
|
|
expect(extendedDate.exportToEuropeanDate()).toEqual('13.02.2018');
|
2019-06-18 12:38:57 +00:00
|
|
|
});
|
|
|
|
|
2020-10-05 17:48:41 +00:00
|
|
|
tap.test('should format a date', async () => {
|
|
|
|
const extendedDate = new smarttime.ExtendedDate(Date.now());
|
|
|
|
console.log(extendedDate.format('YYYY-MM-DD - hh:mm'));
|
2022-11-21 08:14:32 +00:00
|
|
|
});
|
2020-10-05 17:48:41 +00:00
|
|
|
|
2024-06-23 21:27:10 +00:00
|
|
|
export default tap.start();
|