user пре 6 година
родитељ
комит
a300e10a1d
6 измењених фајлова са 17 додато и 1 уклоњено
  1. 1 0
      lib/content-item.d.ts
  2. 6 0
      lib/content-item.js
  3. 1 1
      lib/content-item.js.map
  4. 1 0
      lib/content-params.d.ts
  5. 7 0
      src/content-item.ts
  6. 1 0
      src/content-params.ts

+ 1 - 0
lib/content-item.d.ts

@@ -4,6 +4,7 @@ export declare class ContentItem {
     readonly data: ContentParams;
     readonly hash: string;
     readonly type: string;
+    readonly date: Date;
     readonly myTagsWithoutAll: string[];
     readonly allLinks: ContentLink[];
     readonly userLinks: ContentLink[];

+ 6 - 0
lib/content-item.js

@@ -7,6 +7,12 @@ class ContentItem {
         this.type = props.type;
         this.title = props.title;
         this.text = props.text;
+        if (props.date) {
+            this.date = new Date(props.date);
+        }
+        else {
+            this.date = new Date();
+        }
         if (props.myTags) {
             this.myTagsWithoutAll = props.myTags.filter(x => x !== 'all');
         }

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
lib/content-item.js.map


+ 1 - 0
lib/content-params.d.ts

@@ -1,6 +1,7 @@
 import { ContentLink } from "./content-link";
 export interface ContentParams {
     type: string;
+    date?: string;
     links?: ContentLink[];
     myTags?: string[];
     price?: number;

+ 7 - 0
src/content-item.ts

@@ -6,6 +6,7 @@ export class ContentItem {
   public readonly data: ContentParams;
   public readonly hash: string;
   public readonly type: string;
+  public readonly date: Date;
   
   public readonly myTagsWithoutAll: string[];
   public readonly allLinks: ContentLink[];
@@ -30,6 +31,12 @@ export class ContentItem {
     this.type = props.type;
     this.title = props.title;
     this.text = props.text;
+
+    if (props.date) {
+      this.date = new Date(props.date);
+    } else {
+      this.date = new Date();
+    }
     
     if (props.myTags) {
       this.myTagsWithoutAll = props.myTags.filter(x => x !== 'all');

+ 1 - 0
src/content-params.ts

@@ -2,6 +2,7 @@ import { ContentLink } from "./content-link";
 
 export interface ContentParams {
     type: string;
+    date?: string;
     links?: ContentLink[];
     myTags?: string[];
     price?: number;