Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

blockly-field-date

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blockly-field-date

A Blockly advanced date picker field that uses the Google Closure date picker

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

blockly-field-date Built on Blockly

A Blockly advanced date picker field that uses the Google Closure date picker.

About

Custom date formats using token option (e.g. yyyy-LL-dd)

blockly-field-date

Installation

npm

npm install --save blockly-field-date

yarn

yarn add blockly-field-date

Build

yarn build

Usage

JavaScript

import * as Blockly from 'blockly';
import FieldDate from 'blockly-field-date';

Blockly.Blocks['test_field_date'] = {
  init: function () {
    this.appendDummyInput()
      .appendField('date: ')
      .appendField(new FieldDate('2022-01-11'), 'FIELDNAME');
  }
};

JSON

import * as Blockly from 'blockly';
import 'blockly-field-date';

Blockly.defineBlocksWithJsonArray([
    {
        type: 'test_field_date',
        message0: 'date: %1',
        args0: [
            {
                type: 'field_date',
                name: 'FIELDNAME',
                date: '2022-01-11
            }
        ]
    }]);

JavaScript - extended options

Blockly.Blocks['test_field_date'] = {
  init: function () {
    this.appendDummyInput()
      .appendField('date: ')
      .appendField(new FieldDate('1/11/2022', null, true, 'L/d/yyyy'), 'FIELDNAME');
  }
};

JSON - extended options

Blockly.defineBlocksWithJsonArray([
    {
        type: 'test_field_date',
        message0: 'date: %1',
        args0: [
            {
                type: 'field_date',
                name: 'FIELDNAME',
                date: '1/11/2022',
                token: 'L/d/yyyy',
                textEdit: true
            }
        ]
    }]);

Run in browser

You need to build the package first.

<script src="./dist/date_compressed.js"></script>

License

Apache 2.0

Keywords

FAQs

Package last updated on 22 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc