We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 180e753 commit f7d76ebCopy full SHA for f7d76eb
projects/common/src/time/time.test.ts
@@ -0,0 +1,17 @@
1
+import { Time } from './time';
2
+
3
+describe('Time', () => {
4
+ const mockedTime = new Time(8, 30);
5
6
+ test('can get label', () => {
7
+ expect(mockedTime.label).toBe('8:30 AM');
8
+ });
9
10
+ test('can get date', () => {
11
+ expect(mockedTime.date).toEqual(new Date(`${new Date().toDateString()} 08:30Z`));
12
13
14
+ test('can get ISO String from time', () => {
15
+ expect(mockedTime.toISOString()).toBe('08:30:00.000Z');
16
17
+});
projects/common/src/time/time.ts
@@ -31,4 +31,8 @@ export class Time {
31
public get date(): Date {
32
return this._date;
33
}
34
35
+ public toISOString(): string {
36
+ return this.date.toISOString().substring(11);
37
+ }
38
0 commit comments