File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ import 'moment-timezone' ;
2+ import * as dto from './dto' ;
3+ import * as html from './html' ;
4+ import * as moment from 'moment' ;
5+ import ComponentsArray from './ComponentsArray'
6+ import UiComponent from './UiComponent' ;
7+
8+ export default class DayOff implements UiComponent {
9+ constructor ( private _state : dto . State ,
10+ private _date : string ) {
11+ }
12+
13+ appendTo ( entry : HTMLElement | null ) : void {
14+ let datetime = moment . tz ( `${ this . _date } 23:59` , this . _state . timezone )
15+
16+ new html . Div (
17+ new ComponentsArray ( [
18+ new html . H1 (
19+ new html . Text ( "Day off" )
20+ ) ,
21+ new html . Div (
22+ new html . Text (
23+ datetime . utc ( ) . tz ( moment . tz . guess ( ) ) . format ( 'ddd, ll' )
24+ ) ,
25+ { "class" : "countdown" }
26+ )
27+ ] ) ,
28+ { "class" : moment ( ) . diff ( datetime , 'seconds' ) > 0 ? "event past" : "event" }
29+ ) . appendTo ( entry ) ;
30+ }
31+ }
32+
You can’t perform that action at this time.
0 commit comments