UTC Local TimeZone

This commit is contained in:
Peter Paul Kirschner 2021-10-28 23:03:16 +02:00
parent d4b484eb67
commit edaeb6eba5
5 changed files with 19 additions and 8 deletions

View File

@ -47,6 +47,7 @@ Solution|Author(s)
js-modern-calendar | Jeremy Coleman (MCP, PC Professional, Inc.)
js-modern-calendar | Nanddeep Nachan ([@NanddeepNachan](twitter.com/NanddeepNachan))
js-modern-calendar | Ravi Chandra ([Ravikadri](https://github.com/Ravikadri))
js-modern-calendar | Peter Paul Kirschner ([@petkir_at](https://twitter.com/petkir_at))
## Version history
@ -55,6 +56,7 @@ Version|Date|Comments
1.0.0.0|February 11, 2017|Initial release
1.0.0.1|June 05, 2020|Updated the external CDN references to public CDN references
1.0.2.0|February 9, 2021|Upgraded to SPFx 1.11 and fixed issues with missing dependencies
1.0.3.0|October 28, 2021|fixed issues with Timezones. The Browser Timezone Settings are now used
## Disclaimer

View File

@ -21,7 +21,7 @@
},
{
"key": "SPFX-VERSION",
"value": "1.6.0"
"value": "1.11.0"
}
],
"thumbnails": [
@ -45,6 +45,13 @@
"pictureUrl": "https://github.com/nanddeepn.png",
"name": "Nanddeep Nachan",
"twitter": "NanddeepNachan"
},
{
"gitHubAccount": "petkir",
"company": "Cubido Business Solutions GmbH",
"pictureUrl": "https://github.com/petkir.png",
"name": "Peter Paul Kirschner",
"twitter": "petkir_at"
}
],
"references": [

View File

@ -2,7 +2,7 @@
"solution": {
"name": "SPFx Modern Calendar",
"id": "3d593a2f-73f1-486f-9dae-555c6f6b584d",
"version": "1.0.2.0",
"version": "1.0.3.0",
"includeClientSideAssets": true,
"developer": {
"name": "",

View File

@ -1,6 +1,6 @@
{
"name": "modern-calendar",
"version": "1.0.2",
"version": "1.0.3",
"private": true,
"main": "lib/index.js",
"engines": {

View File

@ -390,10 +390,12 @@ export default class ModernCalendarWebPart extends BaseClientSideWebPart<IModern
private _renderList(items: any[]): void {
var calItems: EventObjectInput[] = items.map((list: any) => {
const start = list[this.properties.start];
const end = list[this.properties.end];
return {
title: list[this.properties.title],
start: list[this.properties.start],
end: list[this.properties.end],
start: moment.utc(start,'YYYY-MM-DD HH:mm:ss').toDate(),
end: moment.utc(end,'YYYY-MM-DD HH:mm:ss').toDate(),
id: list["Id"],
detail: list[this.properties.detail],
};
@ -405,9 +407,9 @@ export default class ModernCalendarWebPart extends BaseClientSideWebPart<IModern
events: calItems,
eventClick: (_event) => {
var eventDetail =
moment(_event["start"]).format("MM/DD/YYYY hh:mm") +
" - " +
moment(_event["end"]).format("MM/DD/YYYY hh:mm") +
moment.utc(_event["start"]).local().format('YYYY-MM-DD hh:mm A') +
" - " +
moment.utc(_event["end"]).local().format('YYYY-MM-DD hh:mm A') +
"<br>" +
_event["detail"];
swal2.default(_event.title, eventDetail, "info");