I know my question is really common question but I did not find the right solution. I have fetched Event from open API. The api gives multiple events and also there are startDate
& endDate
. When I fetched the data, it gives all events but the start dates are not sorted. I want to make one helper function which will sort data by start date and return an Arrays of sort date. But I could not able to do that. I used javascript getTime
for startDate and endDate and compare with them and tried to return the sortData but could not able to do that.
PS: for date validation I am using date-fns
Here is my code and I did not share my wrong approach
.
const data = [
{
id: "helsinki:af52xknl3q",
name: {
fi: "Ruutia! -tanssifestivaali 2021",
en: "Ruutia! Dance Festival 2021",
sv: "Ruutia! -dansfestivalen 2021",
zh: null,
},
source_type: {
id: 1,
name: "LinkedEvents",
},
info_url:
"https://www.hurjaruuth.fi/ruutia-kansainvalinen-tanssifestivaali-lapsille-ja-nuorille/",
modified_at: "2021-09-08T10:04:05.594Z",
location: {
lat: 60.170833587646484,
lon: 24.9375,
address: {
street_address: null,
postal_code: null,
locality: null,
},
},
description: {
intro:
"The annual festival Ruutia! for children and young presents new Finnish and international dance and action theatre performances. ",
body: "<p>The annual festival Ruutia! for children and young presents new Finnish and international dance and action theatre performances. </p>\n<p></p>\n<p>Helsinki<br>25.8.-26.9.2021</p>",
images: [
{
url: "https://api.hel.fi/linkedevents/media/images/Dynamo---BARK-2-269.jpg",
copyright_holder: "",
license_type: {
id: 1,
name: "All rights reserved.",
},
},
],
},
tags: [
{
id: "linkedevents:yso:p1278",
name: "dance (performing arts)",
},
{
id: "linkedevents:yso:p1304",
name: "festivals",
},
{
id: "linkedevents:yso:p4804",
name: "children's culture",
},
],
event_dates: {
starting_day: "2021-08-24T21:01:00.000Z",
ending_day: "2021-09-26T20:59:00.000Z",
additional_description: null,
},
},
{
id: "helsinki:af52w5bga4",
name: {
fi: "DocPoint -dokumenttielokuvafestivaali 2022",
en: "DocPoint -Helsinki Documentary Film Festival 2022",
sv: "DocPoint -dokumentärfilmsfestivalen 2022",
zh: "DocPoint - 赫尔辛基纪录片电影节2022",
},
source_type: {
id: 1,
name: "LinkedEvents",
},
info_url: "https://docpointfestival.fi",
modified_at: "2021-09-08T10:04:05.595Z",
location: {
lat: 60.170833587646484,
lon: 24.9375,
address: {
street_address: null,
postal_code: null,
locality: null,
},
},
description: {
intro:
"DocPoint - Helsinki Documentary Film Festival takes place in winter bringing the best new documentaries from Finland and abroad",
body: "<p>DocPoint - Helsinki Documentary Film Festival takes place in winter bringing the best new documentaries from Finland and abroad, as well as documentary film classics from last decades. </p>\n<p></p>\n<p>Helsinki<br>31.1.-6.2.2022</p>",
images: [
{
url: "https://api.hel.fi/linkedevents/media/images/docpoint2021.jpg",
copyright_holder: "",
license_type: {
id: 1,
name: "All rights reserved.",
},
},
],
},
tags: [
{
id: "linkedevents:yso:p1235",
name: "films",
},
{
id: "linkedevents:yso:p1304",
name: "festivals",
},
{
id: "linkedevents:yso:p13105",
name: "documentary films",
},
],
event_dates: {
starting_day: "2022-01-30T22:01:00.000Z",
ending_day: "2022-02-06T21:59:00.000Z",
additional_description: null,
},
},
{
id: "helsinki:af52v47mu4",
name: {
fi: "Baltic Circle -teatterifestivaali 2021",
en: "Baltic Circle Festival 2021",
sv: "Baltic Circle -teaterfestival 2021",
zh: null,
},
source_type: {
id: 1,
name: "LinkedEvents",
},
info_url: "http://www.balticcircle.fi",
modified_at: "2021-09-08T10:04:05.596Z",
location: {
lat: 60.170833587646484,
lon: 24.9375,
address: {
street_address: null,
postal_code: null,
locality: null,
},
},
description: {
intro:
"The international theatre festival Baltic Circle spreads across the city in November.",
body: "<p>The international theatre festival Baltic Circle spreads across the city in November.</p>\n<p></p>\n<p>Helsinki<br>19.-27.11.2021</p>",
images: [],
},
tags: [
{
id: "linkedevents:yso:p1304",
name: "festivals",
},
{
id: "linkedevents:yso:p2315",
name: "theatre events",
},
{
id: "linkedevents:yso:p2625",
name: "theatre",
},
],
event_dates: {
starting_day: "2021-11-18T22:01:00.000Z",
ending_day: "2021-11-27T21:59:00.000Z",
additional_description: null,
},
},
{
id: "helsinki:af52vvq2fa",
name: {
fi: "We Jazz 2021",
en: "We Jazz 2021",
sv: null,
zh: null,
},
source_type: {
id: 1,
name: "LinkedEvents",
},
info_url: "https://wejazz.fi/",
modified_at: "2021-09-08T10:04:05.596Z",
location: {
lat: 60.170833587646484,
lon: 24.9375,
address: {
street_address: null,
postal_code: null,
locality: null,
},
},
description: {
intro:
"We Jazz Festival will be held in Helsinki for the eighth time in November-December.",
body: "<p>We Jazz Festival will be held in Helsinki for the eighth time in November-December. </p>\n<p></p>\n<p>Presenting the cutting edge of domestic and international jazz, the festival spreads around Helsinki. The program includes e.g. Greg Foat 7tet (UK), Lucia Cadotsch Speak Low, Antti Lötjönen Quintet East, Ilmiliekki Quartet, Iro Haarla Presents: Leo Records, Koma Saxo feat. Sofia Jernberg, OK:KO and Timo Lassy Trio.</p>\n<p></p>\n<p>Helsinki</p>\n<p>28.11.-5.12.2021</p>\n<p>Tickets from Tiketti</p>\n<p></p>\n<p>The guidelines and instructions by authorities concerning covid-19 will be followed. </p>",
images: [],
},
tags: [
{
id: "linkedevents:yso:p1304",
name: "festivals",
},
{
id: "linkedevents:yso:p1808",
name: "music",
},
{
id: "linkedevents:yso:p4484",
name: "jazz",
},
],
event_dates: {
starting_day: "2021-11-27T22:01:00.000Z",
ending_day: "2021-12-05T21:59:00.000Z",
additional_description: null,
},
},
{
id: "helsinki:af3neqvhnq",
name: {
fi: "Helsinki Design Week 2021",
en: "Helsinki Design Week 2021",
sv: "Helsinki Design Week 2021",
zh: "2021赫尔辛基设计周",
},
source_type: {
id: 1,
name: "LinkedEvents",
},
info_url: "http://www.helsinkidesignweek.com",
modified_at: "2021-09-08T10:04:05.597Z",
location: {
lat: 60.170833587646484,
lon: 24.9375,
address: {
street_address: null,
postal_code: null,
locality: null,
},
},
description: {
intro:
"HDW is a series of smaller events selected through an open event search, and a calendar of events is published here. ",
body: "<p></p>\n<p>HDW is a series of smaller events selected through an open event search, and a calendar of events is published here. There will be 80 design-themed events, from open showrooms and studios to smaller exhibitions, workshops for the whole family and walking tours. The programme includes Aalto University’s Designs for a Cooler Planet, where the theme is resource wisdom. The ensemble includes three different exhibition ensembles as well as webinars open to everyone. HDW visitors have the opportunity to learn about radical and multidisciplinary ideas, research, and prototypes in fashion, design and architecture that will contribute to a resource-wise future. </p>\n<p></p>\n<p>The festival programme includes an exhibition by the legendary sculptor and jewelry artist Björn Weckström, which celebrates the long career of the versatile artist. The exhibition, which opens at the Didrichsen Art Museum, features sculptures of acrylic, bronze, stone and glass. Also on display are oil paintings on sailcloths that combine fine art with sailing, Weckström’s second calling. </p>\n<p></p>\n<p>The Design Museum’s Design Super Week includes the exhibition as well as a lunch discussion by the Graphic Designer of the Year Marina Vezik, guided remote tours of the Iittala – Kaleidoscope: From Nature to Culture exhibition and much more. </p>\n<p></p>\n<p>Exceptional conditions due to the Covid19 pandemic continue, and this has been taken into account in planning the events for September.</p>\n<p></p>\n<p>Helsinki, Internet<br>9.-19.9.2021</p>",
images: [
{
url: "https://api.hel.fi/linkedevents/media/images/HDW_LastenDesignviikko9304_.jpg",
copyright_holder: "",
license_type: {
id: 1,
name: "All rights reserved.",
},
},
],
},
tags: [
{
id: "linkedevents:yso:p1304",
name: "festivals",
},
{
id: "linkedevents:yso:p360",
name: "cultural events",
},
{
id: "linkedevents:yso:p6455",
name: "design (artistic creation)",
},
],
event_dates: {
starting_day: "2021-09-08T21:01:00.000Z",
ending_day: "2021-09-19T20:59:00.000Z",
additional_description: null,
},
},
{
id: "helsinki:af44doctru",
name: {
fi: "Etnosoi!-festivaali 2021",
en: "Etnosoi! Festival 2021",
sv: null,
zh: null,
},
source_type: {
id: 1,
name: "LinkedEvents",
},
info_url: "https://www.etnosoi.fi/",
modified_at: "2021-09-08T10:04:05.617Z",
location: {
lat: 60.170833587646484,
lon: 24.9375,
address: {
street_address: null,
postal_code: null,
locality: null,
},
},
description: {
intro:
"The annual Etnosoi! Festival celebrating different musical cultures from around the world will be organized in the Helsinki Metropolitan area next November.",
body: "<p>The annual Etnosoi! Festival celebrating different musical cultures from around the world will be organized in the Helsinki Metropolitan area next November.</p>\n<p></p>\n<p>Helsinki, Espoo, Vantaa</p>\n<p>5.-14.11.2021</p>",
images: [
{
url: "https://api.hel.fi/linkedevents/media/images/ES_Lankalogo2.jpg",
copyright_holder: "",
license_type: {
id: 1,
name: "All rights reserved.",
},
},
],
},
tags: [
{
id: "linkedevents:yso:p1304",
name: "festivals",
},
{
id: "linkedevents:yso:p1808",
name: "music",
},
{
id: "linkedevents:yso:p3065",
name: "world music",
},
],
event_dates: {
starting_day: "2021-11-04T22:01:00.000Z",
ending_day: "2021-11-14T21:59:00.000Z",
additional_description: null,
},
},
{
id: "helsinki:af5binysse",
name: {
fi: "Taideperformanssi: `Mielellään Osoitus`",
en: "Art performance: `Mind-H-App`y ProtestOhLook`",
sv: null,
zh: null,
},
source_type: {
id: 1,
name: "LinkedEvents",
},
info_url: "https://www.terotakala.com/mo2021.html",
modified_at: "2021-09-08T10:04:05.664Z",
location: {
lat: 60.170833587646484,
lon: 24.9375,
address: {
street_address: null,
postal_code: null,
locality: null,
},
},
description: {
intro: "Art performance.",
body: "<p>Art performance. Digital street art. Digital art<br>graphics combined with the moving around in the space of conceptual art dealing with the processing-the-thing using the concept of protest-culture<br>as material.</p>\n<p>Artist: Tero Takala</p>\n<p>Helsinki</p>\n<p>Varying locations in the city centre (eg. Kaivokatu, Mannerheimintie, Aleksanterinkatu, Keskuskatu etc.).</p>\n<p>Starting 18.6.2021 (not necessarily daily) mainly until approx. when rainy days of autumn begin . At varying times during the day.<br><br>Weatherpermitting.</p>\n<p>Free of charge</p>",
images: [
{
url: "https://api.hel.fi/linkedevents/media/images/Taideperformanssi_Mielellään_Osoitus_2_c_Tero_Takala_location_only.jpg",
copyright_holder: "",
license_type: {
id: 1,
name: "All rights reserved.",
},
},
],
},
tags: [
{
id: "linkedevents:yso:p4445",
name: "street art",
},
{
id: "linkedevents:yso:p21073",
name: "digital art",
},
{
id: "linkedevents:yso:p4098",
name: "performance (art forms)",
},
{
id: "linkedevents:yso:p360",
name: "cultural events",
},
{
id: "linkedevents:yso:p2739",
name: "fine arts",
},
],
event_dates: {
starting_day: "2021-06-17T21:01:00.000Z",
ending_day: "2021-09-30T20:59:00.000Z",
additional_description: null,
},
},
{
id: "helsinki:af44crcsam",
name: {
fi: "IHME Helsinki: To Burn, Forest, Fire",
en: "IHME Helsinki: To Burn, Forest, Fire",
sv: null,
zh: null,
},
source_type: {
id: 1,
name: "LinkedEvents",
},
info_url: "https://www.ihmehelsinki.fi/ihme-teos-2021/",
modified_at: "2021-09-08T10:04:05.904Z",
location: {
lat: 60.170833587646484,
lon: 24.9375,
address: {
street_address: null,
postal_code: null,
locality: null,
},
},
description: {
intro:
"The Scottish artist Katie Paterson’s IHME Helsinki Commission 2021, To Burn, Forest, Fire, consists of the scents of the first forest on Earth 385 millions",
body: "<p>The Scottish artist Katie Paterson’s IHME Helsinki Commission 2021, To Burn, Forest, Fire, consists of the scents of the first forest on Earth 385 millions years ago and of the last forest of the age of climate crisis. These scents will be turned into incense and burned in various parts of Helsinki in September 2021.</p>\n<p></p>\n<p>Katie Paterson (born 1981, Scotland) is widely regarded as one of the leading artists of her generation. Collaborating with scientists and researchers across the world, Paterson’s projects consider the place on Earth in the context of geological time and change. Katie Paterson Studio conducts long-term background work with researchers. The ideas for art works spring from the artist’s imagination, but the ability to transform those ideas into finished art works is underpinned by scientific research.</p>\n<p></p>\n<p>Helsinki, various venues, e.g. the Crypt of Helsinki Cathedral, King´s Island, the National Museum and Cultural Centre Stoa.</p>\n<p>1.-30.9.2021 </p>\n<p></p>\n<p>The exact venues and times from IHME Helsinki's website.</p>\n<p>Free entry, duration approx. 1 h</p>\n<p></p>\n<p>Special invited guests for this project will be deaf, blind and deaf-blind people. IHME is arranging visits in collaboration with the Finnish Association of the Deaf, Helsinki and Uusimaa Visually Impaired Association and the Finnish Deafblind Association.</p>\n<p></p>\n<p>The art work is part of Helsinki Biennial Inspired series.</p>",
images: [
{
url: "https://api.hel.fi/linkedevents/media/images/Katie-Paterson-To-Burn-For.jpg",
copyright_holder: "",
license_type: {
id: 1,
name: "All rights reserved.",
},
},
],
},
tags: [
{
id: "linkedevents:yso:p2851",
name: "art",
},
{
id: "linkedevents:yso:p5121",
name: "exhibitions",
},
{
id: "linkedevents:yso:p6889",
name: "art exhibitions",
},
],
event_dates: {
starting_day: "2021-08-31T21:01:00.000Z",
ending_day: "2021-09-30T20:59:00.000Z",
additional_description: null,
},
},
{
id: "helsinki:af5k3544qq",
name: {
fi: "Rakkautta & Anarkiaa 2021",
en: "Love & Anarchy 2021",
sv: "Kärlek & Anarki 2021",
zh: null,
},
source_type: {
id: 1,
name: "LinkedEvents",
},
info_url: "https://hiff.fi/liput",
modified_at: "2021-09-08T10:04:06.091Z",
location: {
lat: 60.170833587646484,
lon: 24.9375,
address: {
street_address: null,
postal_code: null,
locality: null,
},
},
description: {
intro:
"The 34th Helsinki International Film Festival – Love & Anarchy takes place next September.",
body: "<p>The 34th Helsinki International Film Festival – Love & Anarchy takes place next September.</p>\n<p></p>\n<p>The film festival proudly presents new films from well-known filmmakers and fresh talents alike. These are the films which you won't find elsewhere in Finland.</p>\n<p></p>\n<p>Festival programme is a candid mix of bold, controversial and visually stunning new films from all over the world.</p>\n<p></p>\n<p>Helsinki</p>\n<p>16.-26.9.2021</p>\n<p></p>\n<p>Tickets 10/85€ (serier ticket incl. 10 films)</p>\n<p></p>\n<p>Programme and the schedule will be published on Thursday 2 September, which is also the start date of the serial cards' sales. Single tickets sales start on Thursday 9 September.</p>",
images: [
{
url: "https://api.hel.fi/linkedevents/media/images/holmonuorisydan_250918_mari.jpg",
copyright_holder: "",
license_type: {
id: 1,
name: "All rights reserved.",
},
},
],
},
tags: [
{
id: "linkedevents:yso:p1235",
name: "films",
},
{
id: "linkedevents:yso:p1304",
name: "festivals",
},
],
event_dates: {
starting_day: "2021-09-15T21:01:00.000Z",
ending_day: "2021-09-26T20:59:00.000Z",
additional_description: null,
},
},
];
const helperFuntion = (data) => {
return data;
};
const sortEvent = helperFuntion(data);
console.log(sortEvent);
CodePudding user response:
This is a trivial sort with standard text sorting.
No need to convert the date
const data = [ { id: "helsinki:af52xknl3q", name: { fi: "Ruutia! -tanssifestivaali 2021", en: "Ruutia! Dance Festival 2021", sv: "Ruutia! -dansfestivalen 2021", zh: null, }, source_type: { id: 1, name: "LinkedEvents", }, info_url: "https://www.hurjaruuth.fi/ruutia-kansainvalinen-tanssifestivaali-lapsille-ja-nuorille/", modified_at: "2021-09-08T10:04:05.594Z", location: { lat: 60.170833587646484, lon: 24.9375, address: { street_address: null, postal_code: null, locality: null, }, }, description: { intro: "The annual festival Ruutia! for children and young presents new Finnish and international dance and action theatre performances. ", body: "<p>The annual festival Ruutia! for children and young presents new Finnish and international dance and action theatre performances. </p>\n<p></p>\n<p>Helsinki<br>25.8.-26.9.2021</p>", images: [ { url: "https://api.hel.fi/linkedevents/media/images/Dynamo---BARK-2-269.jpg", copyright_holder: "", license_type: { id: 1, name: "All rights reserved.", }, }, ], }, tags: [ { id: "linkedevents:yso:p1278", name: "dance (performing arts)", }, { id: "linkedevents:yso:p1304", name: "festivals", }, { id: "linkedevents:yso:p4804", name: "children's culture", }, ], event_dates: { starting_day: "2021-08-24T21:01:00.000Z", ending_day: "2021-09-26T20:59:00.000Z", additional_description: null, }, }, { id: "helsinki:af52w5bga4", name: { fi: "DocPoint -dokumenttielokuvafestivaali 2022", en: "DocPoint -Helsinki Documentary Film Festival 2022", sv: "DocPoint -dokumentärfilmsfestivalen 2022", zh: "DocPoint - 赫尔辛基纪录片电影节2022", }, source_type: { id: 1, name: "LinkedEvents", }, info_url: "https://docpointfestival.fi", modified_at: "2021-09-08T10:04:05.595Z", location: { lat: 60.170833587646484, lon: 24.9375, address: { street_address: null, postal_code: null, locality: null, }, }, description: { intro: "DocPoint - Helsinki Documentary Film Festival takes place in winter bringing the best new documentaries from Finland and abroad", body: "<p>DocPoint - Helsinki Documentary Film Festival takes place in winter bringing the best new documentaries from Finland and abroad, as well as documentary film classics from last decades. </p>\n<p></p>\n<p>Helsinki<br>31.1.-6.2.2022</p>", images: [ { url: "https://api.hel.fi/linkedevents/media/images/docpoint2021.jpg", copyright_holder: "", license_type: { id: 1, name: "All rights reserved.", }, }, ], }, tags: [ { id: "linkedevents:yso:p1235", name: "films", }, { id: "linkedevents:yso:p1304", name: "festivals", }, { id: "linkedevents:yso:p13105", name: "documentary films", }, ], event_dates: { starting_day: "2022-01-30T22:01:00.000Z", ending_day: "2022-02-06T21:59:00.000Z", additional_description: null, }, }, { id: "helsinki:af52v47mu4", name: { fi: "Baltic Circle -teatterifestivaali 2021", en: "Baltic Circle Festival 2021", sv: "Baltic Circle -teaterfestival 2021", zh: null, }, source_type: { id: 1, name: "LinkedEvents", }, info_url: "http://www.balticcircle.fi", modified_at: "2021-09-08T10:04:05.596Z", location: { lat: 60.170833587646484, lon: 24.9375, address: { street_address: null, postal_code: null, locality: null, }, }, description: { intro: "The international theatre festival Baltic Circle spreads across the city in November.", body: "<p>The international theatre festival Baltic Circle spreads across the city in November.</p>\n<p></p>\n<p>Helsinki<br>19.-27.11.2021</p>", images: [], }, tags: [ { id: "linkedevents:yso:p1304", name: "festivals", }, { id: "linkedevents:yso:p2315", name: "theatre events", }, { id: "linkedevents:yso:p2625", name: "theatre", }, ], event_dates: { starting_day: "2021-11-18T22:01:00.000Z", ending_day: "2021-11-27T21:59:00.000Z", additional_description: null, }, }, { id: "helsinki:af52vvq2fa", name: { fi: "We Jazz 2021", en: "We Jazz 2021", sv: null, zh: null, }, source_type: { id: 1, name: "LinkedEvents", }, info_url: "https://wejazz.fi/", modified_at: "2021-09-08T10:04:05.596Z", location: { lat: 60.170833587646484, lon: 24.9375, address: { street_address: null, postal_code: null, locality: null, }, }, description: { intro: "We Jazz Festival will be held in Helsinki for the eighth time in November-December.", body: "<p>We Jazz Festival will be held in Helsinki for the eighth time in November-December. </p>\n<p></p>\n<p>Presenting the cutting edge of domestic and international jazz, the festival spreads around Helsinki. The program includes e.g. Greg Foat 7tet (UK), Lucia Cadotsch Speak Low, Antti Lötjönen Quintet East, Ilmiliekki Quartet, Iro Haarla Presents: Leo Records, Koma Saxo feat. Sofia Jernberg, OK:KO and Timo Lassy Trio.</p>\n<p></p>\n<p>Helsinki</p>\n<p>28.11.-5.12.2021</p>\n<p>Tickets from Tiketti</p>\n<p></p>\n<p>The guidelines and instructions by authorities concerning covid-19 will be followed. </p>", images: [], }, tags: [ { id: "linkedevents:yso:p1304", name: "festivals", }, { id: "linkedevents:yso:p1808", name: "music", }, { id: "linkedevents:yso:p4484", name: "jazz", }, ], event_dates: { starting_day: "2021-11-27T22:01:00.000Z", ending_day: "2021-12-05T21:59:00.000Z", additional_description: null, }, }, { id: "helsinki:af3neqvhnq", name: { fi: "Helsinki Design Week 2021", en: "Helsinki Design Week 2021", sv: "Helsinki Design Week 2021", zh: "2021赫尔辛基设计周", }, source_type: { id: 1, name: "LinkedEvents", }, info_url: "http://www.helsinkidesignweek.com", modified_at: "2021-09-08T10:04:05.597Z", location: { lat: 60.170833587646484, lon: 24.9375, address: { street_address: null, postal_code: null, locality: null, }, }, description: { intro: "HDW is a series of smaller events selected through an open event search, and a calendar of events is published here. ", body: "<p></p>\n<p>HDW is a series of smaller events selected through an open event search, and a calendar of events is published here. There will be 80 design-themed events, from open showrooms and studios to smaller exhibitions, workshops for the whole family and walking tours. The programme includes Aalto University’s Designs for a Cooler Planet, where the theme is resource wisdom. The ensemble includes three different exhibition ensembles as well as webinars open to everyone. HDW visitors have the opportunity to learn about radical and multidisciplinary ideas, research, and prototypes in fashion, design and architecture that will contribute to a resource-wise future. </p>\n<p></p>\n<p>The festival programme includes an exhibition by the legendary sculptor and jewelry artist Björn Weckström, which celebrates the long career of the versatile artist. The exhibition, which opens at the Didrichsen Art Museum, features sculptures of acrylic, bronze, stone and glass. Also on display are oil paintings on sailcloths that combine fine art with sailing, Weckström’s second calling. </p>\n<p></p>\n<p>The Design Museum’s Design Super Week includes the exhibition as well as a lunch discussion by the Graphic Designer of the Year Marina Vezik, guided remote tours of the Iittala – Kaleidoscope: From Nature to Culture exhibition and much more. </p>\n<p></p>\n<p>Exceptional conditions due to the Covid19 pandemic continue, and this has been taken into account in planning the events for September.</p>\n<p></p>\n<p>Helsinki, Internet<br>9.-19.9.2021</p>", images: [ { url: "https://api.hel.fi/linkedevents/media/images/HDW_LastenDesignviikko9304_.jpg", copyright_holder: "", license_type: { id: 1, name: "All rights reserved.", }, }, ], }, tags: [ { id: "linkedevents:yso:p1304", name: "festivals", }, { id: "linkedevents:yso:p360", name: "cultural events", }, { id: "linkedevents:yso:p6455", name: "design (artistic creation)", }, ], event_dates: { starting_day: "2021-09-08T21:01:00.000Z", ending_day: "2021-09-19T20:59:00.000Z", additional_description: null, }, }, { id: "helsinki:af44doctru", name: { fi: "Etnosoi!-festivaali 2021", en: "Etnosoi! Festival 2021", sv: null, zh: null, }, source_type: { id: 1, name: "LinkedEvents", }, info_url: "https://www.etnosoi.fi/", modified_at: "2021-09-08T10:04:05.617Z", location: { lat: 60.170833587646484, lon: 24.9375, address: { street_address: null, postal_code: null, locality: null, }, }, description: { intro: "The annual Etnosoi! Festival celebrating different musical cultures from around the world will be organized in the Helsinki Metropolitan area next November.", body: "<p>The annual Etnosoi! Festival celebrating different musical cultures from around the world will be organized in the Helsinki Metropolitan area next November.</p>\n<p></p>\n<p>Helsinki, Espoo, Vantaa</p>\n<p>5.-14.11.2021</p>", images: [ { url: "https://api.hel.fi/linkedevents/media/images/ES_Lankalogo2.jpg", copyright_holder: "", license_type: { id: 1, name: "All rights reserved.", }, }, ], }, tags: [ { id: "linkedevents:yso:p1304", name: "festivals", }, { id: "linkedevents:yso:p1808", name: "music", }, { id: "linkedevents:yso:p3065", name: "world music", }, ], event_dates: { starting_day: "2021-11-04T22:01:00.000Z", ending_day: "2021-11-14T21:59:00.000Z", additional_description: null, }, }, { id: "helsinki:af5binysse", name: { fi: "Taideperformanssi: `Mielellään Osoitus`", en: "Art performance: `Mind-H-App`y ProtestOhLook`", sv: null, zh: null, }, source_type: { id: 1, name: "LinkedEvents", }, info_url: "https://www.terotakala.com/mo2021.html", modified_at: "2021-09-08T10:04:05.664Z", location: { lat: 60.170833587646484, lon: 24.9375, address: { street_address: null, postal_code: null, locality: null, }, }, description: { intro: "Art performance.", body: "<p>Art performance. Digital street art. Digital art<br>graphics combined with the moving around in the space of conceptual art dealing with the processing-the-thing using the concept of protest-culture<br>as material.</p>\n<p>Artist: Tero Takala</p>\n<p>Helsinki</p>\n<p>Varying locations in the city centre (eg. Kaivokatu, Mannerheimintie, Aleksanterinkatu, Keskuskatu etc.).</p>\n<p>Starting 18.6.2021 (not necessarily daily) mainly until approx. when rainy days of autumn begin . At varying times during the day.<br><br>Weatherpermitting.</p>\n<p>Free of charge</p>", images: [ { url: "https://api.hel.fi/linkedevents/media/images/Taideperformanssi_Mielellään_Osoitus_2_c_Tero_Takala_location_only.jpg", copyright_holder: "", license_type: { id: 1, name: "All rights reserved.", }, }, ], }, tags: [ { id: "linkedevents:yso:p4445", name: "street art", }, { id: "linkedevents:yso:p21073", name: "digital art", }, { id: "linkedevents:yso:p4098", name: "performance (art forms)", }, { id: "linkedevents:yso:p360", name: "cultural events", }, { id: "linkedevents:yso:p2739", name: "fine arts", }, ], event_dates: { starting_day: "2021-06-17T21:01:00.000Z", ending_day: "2021-09-30T20:59:00.000Z", additional_description: null, }, }, { id: "helsinki:af44crcsam", name: { fi: "IHME Helsinki: To Burn, Forest, Fire", en: "IHME Helsinki: To Burn, Forest, Fire", sv: null, zh: null, }, source_type: { id: 1, name: "LinkedEvents", }, info_url: "https://www.ihmehelsinki.fi/ihme-teos-2021/", modified_at: "2021-09-08T10:04:05.904Z", location: { lat: 60.170833587646484, lon: 24.9375, address: { street_address: null, postal_code: null, locality: null, }, }, description: { intro: "The Scottish artist Katie Paterson’s IHME Helsinki Commission 2021, To Burn, Forest, Fire, consists of the scents of the first forest on Earth 385 millions", body: "<p>The Scottish artist Katie Paterson’s IHME Helsinki Commission 2021, To Burn, Forest, Fire, consists of the scents of the first forest on Earth 385 millions years ago and of the last forest of the age of climate crisis. These scents will be turned into incense and burned in various parts of Helsinki in September 2021.</p>\n<p></p>\n<p>Katie Paterson (born 1981, Scotland) is widely regarded as one of the leading artists of her generation. Collaborating with scientists and researchers across the world, Paterson’s projects consider the place on Earth in the context of geological time and change. Katie Paterson Studio conducts long-term background work with researchers. The ideas for art works spring from the artist’s imagination, but the ability to transform those ideas into finished art works is underpinned by scientific research.</p>\n<p></p>\n<p>Helsinki, various venues, e.g. the Crypt of Helsinki Cathedral, King´s Island, the National Museum and Cultural Centre Stoa.</p>\n<p>1.-30.9.2021 </p>\n<p></p>\n<p>The exact venues and times from IHME Helsinki's website.</p>\n<p>Free entry, duration approx. 1 h</p>\n<p></p>\n<p>Special invited guests for this project will be deaf, blind and deaf-blind people. IHME is arranging visits in collaboration with the Finnish Association of the Deaf, Helsinki and Uusimaa Visually Impaired Association and the Finnish Deafblind Association.</p>\n<p></p>\n<p>The art work is part of Helsinki Biennial Inspired series.</p>", images: [ { url: "https://api.hel.fi/linkedevents/media/images/Katie-Paterson-To-Burn-For.jpg", copyright_holder: "", license_type: { id: 1, name: "All rights reserved.", }, }, ], }, tags: [ { id: "linkedevents:yso:p2851", name: "art", }, { id: "linkedevents:yso:p5121", name: "exhibitions", }, { id: "linkedevents:yso:p6889", name: "art exhibitions", }, ], event_dates: { starting_day: "2021-08-31T21:01:00.000Z", ending_day: "2021-09-30T20:59:00.000Z", additional_description: null, }, }, { id: "helsinki:af5k3544qq", name: { fi: "Rakkautta & Anarkiaa 2021", en: "Love & Anarchy 2021", sv: "Kärlek & Anarki 2021", zh: null, }, source_type: { id: 1, name: "LinkedEvents", }, info_url: "https://hiff.fi/liput", modified_at: "2021-09-08T10:04:06.091Z", location: { lat: 60.170833587646484, lon: 24.9375, address: { street_address: null, postal_code: null, locality: null, }, }, description: { intro: "The 34th Helsinki International Film Festival – Love & Anarchy takes place next September.", body: "<p>The 34th Helsinki International Film Festival – Love & Anarchy takes place next September.</p>\n<p></p>\n<p>The film festival proudly presents new films from well-known filmmakers and fresh talents alike. These are the films which you won't find elsewhere in Finland.</p>\n<p></p>\n<p>Festival programme is a candid mix of bold, controversial and visually stunning new films from all over the world.</p>\n<p></p>\n<p>Helsinki</p>\n<p>16.-26.9.2021</p>\n<p></p>\n<p>Tickets 10/85€ (serier ticket incl. 10 films)</p>\n<p></p>\n<p>Programme and the schedule will be published on Thursday 2 September, which is also the start date of the serial cards' sales. Single tickets sales start on Thursday 9 September.</p>", images: [ { url: "https://api.hel.fi/linkedevents/media/images/holmonuorisydan_250918_mari.jpg", copyright_holder: "", license_type: { id: 1, name: "All rights reserved.", }, }, ], }, tags: [ { id: "linkedevents:yso:p1235", name: "films", }, { id: "linkedevents:yso:p1304", name: "festivals", }, ], event_dates: { starting_day: "2021-09-15T21:01:00.000Z", ending_day: "2021-09-26T20:59:00.000Z", additional_description: null, }, }, ];
console.log("before")
data.forEach(date => console.log(date.event_dates.starting_day))
data.sort((a,b) => {
if(a.event_dates.starting_day > b.event_dates.starting_day) return 1;
if(a.event_dates.starting_day < b.event_dates.starting_day) return -1;
return 0;
})
console.log("after")
data.forEach(date => console.log(date.event_dates.starting_day))
console.log(data);