JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Date & Time Pickers › Typescript compile error Smart.Utilities.DateTime
Tagged: datetimepicker
- This topic has 11 replies, 2 voices, and was last updated 1 year, 1 month ago by
admin.
-
AuthorPosts
-
July 2, 2021 at 9:46 am #101969
davout
MemberI’m building an Angular app and using the Smart DateTimePicker component
In my Typescript file within IntelliJ editor , I’m getting an “TS2503: Cannot find namespace ‘Smart’.” error when Typescript is compiledimport {Component, OnDestroy, OnInit} from '@angular/core'; import {TaskUiMediator} from '../mediators/task.ui.mediator'; import {faArrowAltCircleLeft, faArrowAltCircleRight} from '@fortawesome/pro-light-svg-icons'; import {Smart} from 'smart-webcomponents-angular/datetimepicker'; import {TaskViewsService} from '../common/task-views.service'; import {TaskFilterMediator} from '../mediators/task.filter.mediator'; import {BehaviorSubject, Observable, Subscription} from 'rxjs'; import {DateFilterUtil} from '../mediators/DateFilterUtil'; import {DateUtil} from '../common/DateUtil'; @Component({ selector: 'app-task-week', templateUrl: './task-week.component.html', styleUrls: ['./task-week.component.css'] }) export class TaskWeekComponent implements OnInit, OnDestroy { public viewId = TaskViewsService.TASK_VIEW_WEEK; iconLeft = faArrowAltCircleLeft; iconRight = faArrowAltCircleRight; pageSize = 1000; private dateValueSubject = new BehaviorSubject<Smart.Utilities.DateTime>(new Smart.Utilities.DateTime(DateUtil.today()));
July 5, 2021 at 7:35 am #101972admin
KeymasterHi davout,
There is not ‘Smart.Utilities.DateTime’ in ‘Smart’ typescript defs. That is the reason you’re getting typescript error.
Best regards,
Peter Stoev
Smart UI Team
https://www.htmlelements.com/July 5, 2021 at 8:31 am #101974July 5, 2021 at 9:05 am #101975admin
KeymasterHi davout,
We have multiple online demos for this component which show how to use it with Angular. You may look at them here: https://www.htmlelements.com/angular/demos/datetimepicker/overview/. You can also edit samples in Stackblitz.
Best regards,
Peter Stoev
Smart UI Team
https://www.htmlelements.com/July 5, 2021 at 9:48 am #101978davout
MemberJuly 5, 2021 at 10:09 am #101979admin
KeymasterHi davout,
There is no import for Smart.Utilities.DateTime because it is not used anywhere. Such Typescript definition does not exist.
Best regards,
Peter Stoev
Smart UI Team
https://www.htmlelements.com/July 5, 2021 at 10:28 am #101980July 5, 2021 at 10:32 am #101982admin
KeymasterHi davout,
You do not need to use the DateTime class in order to use DatetimePicker. The examples clearly show how you can use the component and get/set dates to it. This class is internally used and for Angular it is not part of the public API.
Best regards,
Peter Stoev
Smart UI Team
https://www.htmlelements.com/July 5, 2021 at 10:38 am #101983davout
MemberJuly 5, 2021 at 10:52 am #101985admin
KeymasterHi davout,
In future versions of the library, we will add a new Angular example of our DateTimePicker and expose additional API options. Again, Typescript definitions are not available for what you try to use. They do not exist.
Best regards,
Peter Stoev
Smart UI Team
https://www.htmlelements.com/July 5, 2021 at 11:02 am #101986davout
MemberJuly 5, 2021 at 11:11 am #101987admin
KeymasterHi davout,
Your question was about a Typescript error and the answer is that such error is raised, because there is no such Typescript API. The DateTimePicker accepts Javascript Date object. You can set the ‘value’ prop to a Javascript date.
Best regards,
Peter Stoev
Smart UI Team
https://www.htmlelements.com/ -
AuthorPosts
- You must be logged in to reply to this topic.