File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,6 +93,32 @@ export class FieldDate extends Blockly.FieldTextInput {
9393 return getLocaleDateString ( value ) ;
9494 }
9595
96+ /**
97+ * Returns a description of the type of this field for screenreaders.
98+ */
99+ override getAriaTypeName ( ) {
100+ return Blockly . Msg [ 'ARIA_TYPE_FIELD_DATE' ] ;
101+ }
102+
103+ /**
104+ * Returns a description of the current date for use by screenreaders.
105+ */
106+ override getAriaValue ( ) {
107+ const stringValue = this . getValue ( ) ;
108+ if ( ! stringValue ) return super . getAriaValue ( ) ;
109+
110+ const date = new Date ( stringValue ) ;
111+ // Use a localized long-form description of the date, e.g. January XX, 20XX,
112+ // rather than a short-form/ISO version of the date which may be read out
113+ // with slashes or the like.
114+ return date . toLocaleDateString ( undefined , {
115+ year : 'numeric' ,
116+ month : 'long' ,
117+ day : 'numeric' ,
118+ timeZone : 'UTC' ,
119+ } ) ;
120+ }
121+
96122 /**
97123 * Renders the field. If the picker is shown make sure it has the current
98124 * date selected.
You can’t perform that action at this time.
0 commit comments