Advertisement
Guest User

microsoft lists date column

a guest
Jan 5th, 2024
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 7.30 KB | Source Code | 0 0
  1. {
  2.   "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  3.   "elmType": "div",
  4.   "style": {
  5.     "display": "flex",
  6.     "flex-direction": "column",
  7.     "margin": "5px"
  8.   },
  9.   "children": [
  10.     {
  11.       "elmType": "div",
  12.       "style": {
  13.         "display": "flex",
  14.         "flex-direction": "row",
  15.         "justify-content": "space-between",
  16.         "width": "100%",
  17.         "margin-bottom": "3px"
  18.       },
  19.       "attributes": {
  20.         "class": "ms-fontColor-ms-fontColor-themeDark ms-fontWeight-bold"
  21.       },
  22.       "children": [
  23.         {
  24.           "elmType": "span",
  25.           "style": {
  26.             "width": "100%",
  27.             "text-align": "left"
  28.           },
  29.           "txtContent": "1"
  30.         },
  31.         {
  32.           "elmType": "span",
  33.           "style": {
  34.             "width": "100%",
  35.             "text-align": "left"
  36.           },
  37.           "txtContent": "2"
  38.         },
  39.         {
  40.           "elmType": "span",
  41.           "style": {
  42.             "width": "100%",
  43.             "text-align": "left"
  44.           },
  45.           "txtContent": "3"
  46.         },
  47.         {
  48.           "elmType": "span",
  49.           "style": {
  50.             "width": "100%",
  51.             "text-align": "left"
  52.           },
  53.           "txtContent": "4"
  54.         },
  55.         {
  56.           "elmType": "span",
  57.           "style": {
  58.             "width": "100%",
  59.             "text-align": "left"
  60.           },
  61.           "txtContent": "5"
  62.         },
  63.         {
  64.           "elmType": "span",
  65.           "style": {
  66.             "width": "100%",
  67.             "text-align": "left"
  68.           },
  69.           "txtContent": "6"
  70.         },
  71.         {
  72.           "elmType": "span",
  73.           "style": {
  74.             "width": "100%",
  75.             "text-align": "left"
  76.           },
  77.           "txtContent": "7"
  78.         },
  79.         {
  80.           "elmType": "span",
  81.           "style": {
  82.             "width": "100%",
  83.             "text-align": "left"
  84.           },
  85.           "txtContent": "8"
  86.         },
  87.         {
  88.           "elmType": "span",
  89.           "style": {
  90.             "width": "100%",
  91.             "text-align": "left"
  92.           },
  93.           "txtContent": "9"
  94.         },
  95.         {
  96.           "elmType": "span",
  97.           "style": {
  98.             "width": "100%",
  99.             "text-align": "left"
  100.           },
  101.           "txtContent": "10"
  102.         },
  103.         {
  104.           "elmType": "span",
  105.           "style": {
  106.             "width": "100%",
  107.             "text-align": "left"
  108.           },
  109.           "txtContent": "11"
  110.         },
  111.         {
  112.           "elmType": "span",
  113.           "style": {
  114.             "width": "100%",
  115.             "text-align": "left"
  116.           },
  117.           "txtContent": "12"
  118.         }
  119.       ]
  120.     },
  121.     {
  122.       "elmType": "div",
  123.       "style": {
  124.         "display": "flex",
  125.         "width": "100%",
  126.         "border": "2px solid",
  127.         "height": "20px"
  128.       },
  129.       "attributes": {
  130.         "class": "ms-fontColor-themePrimary"
  131.       },
  132.       "children": [
  133.         {
  134.           "elmType": "div",
  135.           "style": {
  136.             "position": "relative",
  137.             "cursor": "pointer",
  138.             "width": "=((Number(Date([$PrepEnd])) - Number(Date([$PrepStart]))) / (Number(Date('' + getYear([$PrepStart]) + '/12/31')) - Number(Date('' + getYear([$PrepStart]) + '/01/01')))) * 100 + '%'",
  139.             "left": "=((Number(Date([$PrepStart])) - Number(Date('' + getYear([$PrepStart]) + '/01/01'))) / (Number(Date('' + getYear([$PrepStart]) + '/12/31')) - Number(Date('' + getYear([$PrepStart]) + '/01/01')))) * 100 + '%'"
  140.           },
  141.           "attributes": {
  142.             "class": "ms-bgColor-themeLight ms-bgColor-themeTertiary--hover"
  143.           },
  144.           "customCardProps": {
  145.             "directionalHint": "topCenter",
  146.             "isBeakVisible": true,
  147.             "openOnEvent": "hover",
  148.             "formatter": {
  149.               "elmType": "div",
  150.               "style": {
  151.                 "display": "flex",
  152.                 "align-items": "center",
  153.                 "justify-content": "center",
  154.                 "width": "250px",
  155.                 "height": "30px",
  156.                 "margin": "10px",
  157.                 "font-weight": "bold"
  158.               },
  159.               "attributes": {
  160.                 "class": "ms-fontSize-l"
  161.               },
  162.               "children": [
  163.                 {
  164.                   "elmType": "div",
  165.                   "children": [
  166.                     {
  167.                       "elmType": "span",
  168.                       "txtContent": "[$PrepStart.displayValue]"
  169.                     },
  170.                     {
  171.                       "elmType": "span",
  172.                       "style": {
  173.                         "margin-left": "5px",
  174.                         "margin-right": "5px"
  175.                       },
  176.                       "txtContent": "-"
  177.                     },
  178.                     {
  179.                       "elmType": "span",
  180.                       "txtContent": "[$PrepEnd.displayValue]"
  181.                     }
  182.                   ]
  183.                 }
  184.               ]
  185.             }
  186.           }
  187.         },
  188.         {
  189.           "elmType": "div",
  190.           "style": {
  191.             "position": "relative",
  192.             "cursor": "pointer",
  193.             "width": "=((Number(Date([$End])) - Number(Date([$Start]))) / (Number(Date('' + getYear([$Start]) + '/12/31')) - Number(Date('' + getYear([$Start]) + '/01/01')))) * 100 + '%'",
  194.             "left": "=(((Number(Date([$Start])) - Number(Date('' + getYear([$Start]) + '/01/01'))) / (Number(Date('' + getYear([$Start]) + '/12/31')) - Number(Date('' + getYear([$Start]) + '/01/01')))) * 100) - (((Number(Date([$PrepEnd])) - Number(Date([$PrepStart]))) / (Number(Date('' + getYear([$PrepStart]) + '/12/31')) - Number(Date('' + getYear([$PrepStart]) + '/01/01')))) * 100) + '%'"
  195.           },
  196.           "attributes": {
  197.             "class": "ms-bgColor-themeSecondary ms-bgColor-themeTertiary--hover"
  198.           },
  199.           "customCardProps": {
  200.             "directionalHint": "topCenter",
  201.             "isBeakVisible": true,
  202.             "openOnEvent": "hover",
  203.             "formatter": {
  204.               "elmType": "div",
  205.               "style": {
  206.                 "display": "flex",
  207.                 "align-items": "center",
  208.                 "justify-content": "center",
  209.                 "width": "250px",
  210.                 "height": "30px",
  211.                 "margin": "10px",
  212.                 "font-weight": "bold"
  213.               },
  214.               "attributes": {
  215.                 "class": "ms-fontSize-l"
  216.               },
  217.               "children": [
  218.                 {
  219.                   "elmType": "div",
  220.                   "children": [
  221.                     {
  222.                       "elmType": "span",
  223.                       "txtContent": "[$Start.displayValue]"
  224.                     },
  225.                     {
  226.                       "elmType": "span",
  227.                       "style": {
  228.                         "margin-left": "5px",
  229.                         "margin-right": "5px"
  230.                       },
  231.                       "txtContent": "-"
  232.                     },
  233.                     {
  234.                       "elmType": "span",
  235.                       "txtContent": "[$End.displayValue]"
  236.                     }
  237.                   ]
  238.                 }
  239.               ]
  240.             }
  241.           }
  242.         }
  243.       ]
  244.     }
  245.   ]
  246. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement