Skip to content

Commit dcc6765

Browse files
Merge pull request #1 from vinoth-Kumar-S/main
Angular DateRangePicker sample
2 parents 62aaa77 + d6d3169 commit dcc6765

20 files changed

+491
-2
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
1-
# getting-started-with-the-angular-daterangepicker-component
2-
A quick-start Angular project that let you work with the Angular DateRangePicker component of Syncfusion. This project contains simple code customizations, as well as some important features like setting specific date range values, format, placeholder, range restrictions, day span, and month range picker.
1+
# Getting Started with the Angular DateRangePicker Component
2+
3+
A quick-start Angular project that shows how to work with the Angular DateRangePicker component of Syncfusion. This project contains simple code customizations, as well as some important features like setting specific date range values, format, placeholder, range restrictions, day span, and month range picker.
4+
5+
Documentation: https://ej2.syncfusion.com/angular/documentation/daterangepicker/getting-started/
6+
Online examples: https://ej2.syncfusion.com/angular/demos/#/bootstrap5/daterangepicker/default
7+
8+
## Project prerequisites
9+
10+
Make sure that you have the latest versions of NodeJS and Visual Studio Code in your machine before starting to work on this project.
11+
12+
### How to run this application?
13+
14+
To run this application, you need to clone the `getting-started-with-the-angular-daterangepicker-component` repository and then open it in Visual Studio Code. Now, simply install all the necessary react packages into your current project using the `npm install` command and run your project using the `ng serve` command.

angular.json

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"myangularproject": {
7+
"projectType": "application",
8+
"schematics": {
9+
"@schematics/angular:application": {
10+
"strict": true
11+
}
12+
},
13+
"root": "",
14+
"sourceRoot": "src",
15+
"prefix": "app",
16+
"architect": {
17+
"build": {
18+
"builder": "@angular-devkit/build-angular:browser",
19+
"options": {
20+
"outputPath": "dist/myangularproject",
21+
"index": "src/index.html",
22+
"main": "src/main.ts",
23+
"polyfills": "src/polyfills.ts",
24+
"tsConfig": "tsconfig.app.json",
25+
"assets": [
26+
"src/favicon.ico",
27+
"src/assets"
28+
],
29+
"styles": [
30+
"src/styles.css"
31+
],
32+
"scripts": []
33+
},
34+
"configurations": {
35+
"production": {
36+
"budgets": [
37+
{
38+
"type": "initial",
39+
"maximumWarning": "500kb",
40+
"maximumError": "1mb"
41+
},
42+
{
43+
"type": "anyComponentStyle",
44+
"maximumWarning": "2kb",
45+
"maximumError": "4kb"
46+
}
47+
],
48+
"fileReplacements": [
49+
{
50+
"replace": "src/environments/environment.ts",
51+
"with": "src/environments/environment.prod.ts"
52+
}
53+
],
54+
"outputHashing": "all"
55+
},
56+
"development": {
57+
"buildOptimizer": false,
58+
"optimization": false,
59+
"vendorChunk": true,
60+
"extractLicenses": false,
61+
"sourceMap": true,
62+
"namedChunks": true
63+
}
64+
},
65+
"defaultConfiguration": "production"
66+
},
67+
"serve": {
68+
"builder": "@angular-devkit/build-angular:dev-server",
69+
"configurations": {
70+
"production": {
71+
"browserTarget": "myangularproject:build:production"
72+
},
73+
"development": {
74+
"browserTarget": "myangularproject:build:development"
75+
}
76+
},
77+
"defaultConfiguration": "development"
78+
},
79+
"extract-i18n": {
80+
"builder": "@angular-devkit/build-angular:extract-i18n",
81+
"options": {
82+
"browserTarget": "myangularproject:build"
83+
}
84+
},
85+
"test": {
86+
"builder": "@angular-devkit/build-angular:karma",
87+
"options": {
88+
"main": "src/test.ts",
89+
"polyfills": "src/polyfills.ts",
90+
"tsConfig": "tsconfig.spec.json",
91+
"karmaConfig": "karma.conf.js",
92+
"assets": [
93+
"src/favicon.ico",
94+
"src/assets"
95+
],
96+
"styles": [
97+
"src/styles.css"
98+
],
99+
"scripts": []
100+
}
101+
}
102+
}
103+
}
104+
},
105+
"defaultProject": "myangularproject"
106+
}

karma.conf.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/1.0/config/configuration-file.html
3+
4+
module.exports = function (config) {
5+
config.set({
6+
basePath: '',
7+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-jasmine-html-reporter'),
12+
require('karma-coverage'),
13+
require('@angular-devkit/build-angular/plugins/karma')
14+
],
15+
client: {
16+
jasmine: {
17+
// you can add configuration options for Jasmine here
18+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19+
// for example, you can disable the random execution with `random: false`
20+
// or set a specific seed with `seed: 4321`
21+
},
22+
clearContext: false // leave Jasmine Spec Runner output visible in browser
23+
},
24+
jasmineHtmlReporter: {
25+
suppressAll: true // removes the duplicated traces
26+
},
27+
coverageReporter: {
28+
dir: require('path').join(__dirname, './coverage/myangularproject'),
29+
subdir: '.',
30+
reporters: [
31+
{ type: 'html' },
32+
{ type: 'text-summary' }
33+
]
34+
},
35+
reporters: ['progress', 'kjhtml'],
36+
port: 9876,
37+
colors: true,
38+
logLevel: config.LOG_INFO,
39+
autoWatch: true,
40+
browsers: ['Chrome'],
41+
singleRun: false,
42+
restartOnFileChange: true
43+
});
44+
};

package.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "myangularproject",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"ng": "ng",
6+
"start": "ng serve",
7+
"build": "ng build",
8+
"watch": "ng build --watch --configuration development",
9+
"test": "ng test"
10+
},
11+
"private": true,
12+
"dependencies": {
13+
"@angular/animations": "~13.3.0",
14+
"@angular/common": "~13.3.0",
15+
"@angular/compiler": "~13.3.0",
16+
"@angular/core": "~13.3.0",
17+
"@angular/forms": "~13.3.0",
18+
"@angular/platform-browser": "~13.3.0",
19+
"@angular/platform-browser-dynamic": "~13.3.0",
20+
"@angular/router": "~13.3.0",
21+
"@syncfusion/ej2-angular-calendars": "^20.1.52",
22+
"rxjs": "~7.5.0",
23+
"tslib": "^2.3.0",
24+
"zone.js": "~0.11.4"
25+
},
26+
"devDependencies": {
27+
"@angular-devkit/build-angular": "~13.3.5",
28+
"@angular/cli": "~13.3.5",
29+
"@angular/compiler-cli": "~13.3.0",
30+
"@types/jasmine": "~3.10.0",
31+
"@types/node": "^12.11.1",
32+
"jasmine-core": "~4.0.0",
33+
"karma": "~6.3.0",
34+
"karma-chrome-launcher": "~3.1.0",
35+
"karma-coverage": "~2.1.0",
36+
"karma-jasmine": "~4.0.0",
37+
"karma-jasmine-html-reporter": "~1.7.0",
38+
"typescript": "~4.6.2"
39+
}
40+
}

src/app/app.component.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* empty file */

src/app/app.component.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<div class="container">
2+
<ejs-daterangepicker placeholder="Select a date range"
3+
[startDate]="startDateValue"
4+
[endDate]="endDateValue"
5+
[min]="minDate"
6+
[minDays]="minDayValue"
7+
format="dd-MMM-yy"
8+
start="Year"
9+
depth="Year">
10+
</ejs-daterangepicker>
11+
<!-- [max]="maxDate" -->
12+
<!-- [maxDays]="maxDayValue" -->
13+
</div>
14+
15+
<style>
16+
.container{
17+
width: 250px;
18+
margin: 5% auto;
19+
}
20+
</style>

src/app/app.component.spec.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { TestBed } from '@angular/core/testing';
2+
import { RouterTestingModule } from '@angular/router/testing';
3+
import { AppComponent } from './app.component';
4+
5+
describe('AppComponent', () => {
6+
beforeEach(async () => {
7+
await TestBed.configureTestingModule({
8+
imports: [
9+
RouterTestingModule
10+
],
11+
declarations: [
12+
AppComponent
13+
],
14+
}).compileComponents();
15+
});
16+
17+
it('should create the app', () => {
18+
const fixture = TestBed.createComponent(AppComponent);
19+
const app = fixture.componentInstance;
20+
expect(app).toBeTruthy();
21+
});
22+
23+
it(`should have as title 'myangularproject'`, () => {
24+
const fixture = TestBed.createComponent(AppComponent);
25+
const app = fixture.componentInstance;
26+
expect(app.title).toEqual('myangularproject');
27+
});
28+
29+
it('should render title', () => {
30+
const fixture = TestBed.createComponent(AppComponent);
31+
fixture.detectChanges();
32+
const compiled = fixture.nativeElement as HTMLElement;
33+
expect(compiled.querySelector('.content span')?.textContent).toContain('myangularproject app is running!');
34+
});
35+
});

src/app/app.component.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-root',
5+
templateUrl: './app.component.html',
6+
styleUrls: ['./app.component.css']
7+
})
8+
export class AppComponent {
9+
title = 'myangularproject';
10+
public startDateValue: Date = new Date(2022, 5, 13);
11+
public endDateValue: Date = new Date(2022, 5, 17);
12+
public minDate: Date = new Date(2022, 5, 6);
13+
public maxDate: Date = new Date(2022, 6, 22);
14+
public minDayValue: Number = 5;
15+
public maxDayValue: Number = 10;
16+
}

src/app/app.module.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { NgModule } from '@angular/core';
2+
import { BrowserModule } from '@angular/platform-browser';
3+
import {DateRangePickerModule} from '@syncfusion/ej2-angular-calendars';
4+
import { AppComponent } from './app.component';
5+
6+
@NgModule({
7+
declarations: [
8+
AppComponent
9+
],
10+
imports: [
11+
BrowserModule,
12+
DateRangePickerModule
13+
],
14+
providers: [],
15+
bootstrap: [AppComponent]
16+
})
17+
export class AppModule { }
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const environment = {
2+
production: true
3+
};

0 commit comments

Comments
 (0)