@planningcenter/tapestry-react 2.8.2 → 2.9.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -87,9 +87,15 @@ var TimeField = /*#__PURE__*/function (_Component) {
87
87
  }, _this.updateTime);
88
88
  });
89
89
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleHoursChange", function (hours) {
90
- _this.updateTime({
91
- hours: hours
92
- });
90
+ if (_this.twelveHourClock && hours === 0) {
91
+ _this.updateTime({
92
+ hours: 12
93
+ });
94
+ } else {
95
+ _this.updateTime({
96
+ hours: hours
97
+ });
98
+ }
93
99
  });
94
100
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleHoursKeyDown", function (event) {
95
101
  var hour = Number(event.target.value);
@@ -215,7 +221,7 @@ var TimeField = /*#__PURE__*/function (_Component) {
215
221
  fontVariantNumeric: "tabular-nums",
216
222
  moveFocusOnMax: true,
217
223
  value: twelveHourClock ? hours % _utils2.HOURS_TO_NOON || _utils2.HOURS_TO_NOON : hours,
218
- min: twelveHourClock ? 1 : 0,
224
+ min: 0,
219
225
  max: twelveHourClock ? _utils2.HOURS_TO_NOON : _utils2.HOURS_IN_DAY - 1,
220
226
  pad: 2,
221
227
  grow: 0,
@@ -78,9 +78,15 @@ var TimeField = /*#__PURE__*/function (_Component) {
78
78
  });
79
79
 
80
80
  _defineProperty(_assertThisInitialized(_this), "handleHoursChange", function (hours) {
81
- _this.updateTime({
82
- hours: hours
83
- });
81
+ if (_this.twelveHourClock && hours === 0) {
82
+ _this.updateTime({
83
+ hours: 12
84
+ });
85
+ } else {
86
+ _this.updateTime({
87
+ hours: hours
88
+ });
89
+ }
84
90
  });
85
91
 
86
92
  _defineProperty(_assertThisInitialized(_this), "handleHoursKeyDown", function (event) {
@@ -213,7 +219,7 @@ var TimeField = /*#__PURE__*/function (_Component) {
213
219
  fontVariantNumeric: "tabular-nums",
214
220
  moveFocusOnMax: true,
215
221
  value: twelveHourClock ? hours % HOURS_TO_NOON || HOURS_TO_NOON : hours,
216
- min: twelveHourClock ? 1 : 0,
222
+ min: 0,
217
223
  max: twelveHourClock ? HOURS_TO_NOON : HOURS_IN_DAY - 1,
218
224
  pad: 2,
219
225
  grow: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/tapestry-react",
3
- "version": "2.8.2",
3
+ "version": "2.9.0-rc.0",
4
4
  "description": "A collection of flexible React components to help you build resilient, accessible user interfaces quickly and effectively.",
5
5
  "author": "Front End Systems Engineering <frontend@pco.bz>",
6
6
  "main": "dist/cjs/index.js",
@@ -118,7 +118,11 @@ class TimeField extends Component<Props> {
118
118
  }
119
119
 
120
120
  handleHoursChange = (hours) => {
121
- this.updateTime({ hours })
121
+ if (this.twelveHourClock && hours === 0) {
122
+ this.updateTime({ hours: 12 })
123
+ } else {
124
+ this.updateTime({ hours })
125
+ }
122
126
  }
123
127
 
124
128
  handleHoursKeyDown = (event) => {
@@ -228,7 +232,7 @@ class TimeField extends Component<Props> {
228
232
  value={
229
233
  twelveHourClock ? hours % HOURS_TO_NOON || HOURS_TO_NOON : hours
230
234
  }
231
- min={twelveHourClock ? 1 : 0}
235
+ min={0}
232
236
  max={twelveHourClock ? HOURS_TO_NOON : HOURS_IN_DAY - 1}
233
237
  pad={2}
234
238
  grow={0}