Back to column formats
Column formattingSharePoint Online

Time Schedule

This sample demonstrates a time schedule with a filled background from Start time to End time.

Time Schedule formatting preview
Sample preview · View original image

Copy. Apply. Make it yours.

Get this format

1 definition

Review the requirements below, then paste this JSON into the matching formatting panel. Show me where.

Use your list's internal column names and replace any tenant-specific URLs or flow IDs. Formatting is presentation, not a way to secure data.

Column formatting
Download JSON
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "style": {
    "display": "flex",
    "flex-direction": "column",
    "width": "288px",
    "height": "70px",
    "margin": "5px",
    "fill": "currentColor"
  },
  "children": [
    {
      "elmType": "div",
      "style": {
        "display": "flex",
        "justify-content": "space-between",
        "width": "105%",
        "padding-bottom": "5px"
      },
      "attributes": {
        "class": "ms-fontColor-themePrimary ms-fontWeight-bold"
      },
      "children": [
        {
          "elmType": "span",
          "txtContent": "00"
        },
        {
          "elmType": "span",
          "txtContent": "03"
        },
        {
          "elmType": "span",
          "txtContent": "06"
        },
        {
          "elmType": "span",
          "txtContent": "09"
        },
        {
          "elmType": "span",
          "txtContent": "12"
        },
        {
          "elmType": "span",
          "txtContent": "15"
        },
        {
          "elmType": "span",
          "txtContent": "18"
        },
        {
          "elmType": "span",
          "txtContent": "21"
        },
        {
          "elmType": "span",
          "txtContent": "24"
        }
      ]
    },
    {
      "elmType": "div",
      "style": {
        "width": "100%",
        "border": "2px solid",
        "height": "40px"
      },
      "attributes": {
        "class": "ms-fontColor-themePrimary"
      },
      "children": [
        {
          "elmType": "svg",
          "style": {
            "width": "100%",
            "height": "100%"
          },
          "children": [
            {
              "elmType": "path",
              "attributes": {
                "d": "= 'M ' + (Number(substring([$Start],0,2)) * 60 + Number(substring([$Start],3,5))) * 0.2 + ',0  ' + (Number(substring([$End],0,2)) * 60 + Number(substring([$End],3,5))) * 0.2 + ',0 ' + (Number(substring([$End],0,2)) * 60 + Number(substring([$End],3,5))) * 0.2 + ',40 ' + (Number(substring([$Start],0,2)) * 60 + Number(substring([$Start],3,5))) * 0.2 + ', 40 Z'"
              }
            }
          ]
        }
      ]
    }
  ]
}

From the contributor

How to use this sample

Summary

This sample demonstrates a time schedule with a filled background from Start time to End time.

screenshot of the sample

View requirements

This format can be applied to any column type but expects the following columns to be part of the view:

Type Internal Name Required
Single line of text or Choice Start Yes
Single line of text or Choice End Yes

Start and End columns must be in hh:mm format.

Sample

Solution Author(s)
generic-time-schedule.json Tetsuya Kawahara

Version history

Version Date Comments
1.0 November 3, 2020 Initial release

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.