Skip to main content

@blockly/field-date

Built with Blockly​

A Blockly plugin that uses a browser default "date" input.

Installation​

Yarn​

yarn add @blockly/field-date

npm​

npm install @blockly/field-date --save

Usage​

JavaScript​

import * as Blockly from 'blockly';
import {FieldDate} from '@blockly/field-date';

Blockly.Blocks['test_fields_date'] = {
init: function () {
this.appendDummyInput()
.appendField('date: ')
.appendField(new FieldDate('2020-02-20'), 'FIELDNAME');
},
};

JSON​

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

Blockly.defineBlocksWithJsonArray([
{
type: 'test_fields_date',
message0: 'date: %1',
args0: [
{
type: 'field_date',
name: 'FIELDNAME',
date: '2020-02-20',
},
],
},
]);

License​

Apache 2.0

A Blockly date picker field that uses the browser's date picker.

Classes​

ClassDescription
FieldDateClass for a date input field.

Interfaces​

InterfaceDescription
FieldDateConfigA config object for defining a field date.
FieldDateFromJsonConfigOptions used to define a field date from JSON.

Type Aliases​

Type AliasDescription
FieldDateValidator-

Functions​

FunctionDescription
isISOFormatValidate a string value to see if it matches the format.
toLocalISOStringConvert the date to ISO format for the current timezone.