MCPcopy Create free account
hub / github.com/csev/py4e / startOf

Function startOf

code/gmane/Chart.bundle.js:3601–3642  ·  view source on GitHub ↗
(units)

Source from the content-addressed store, hash-verified

3599 }
3600
3601 function startOf (units) {
3602 units = normalizeUnits(units);
3603 // the following switch intentionally omits break keywords
3604 // to utilize falling through the cases.
3605 switch (units) {
3606 case 'year':
3607 this.month(0);
3608 /* falls through */
3609 case 'quarter':
3610 case 'month':
3611 this.date(1);
3612 /* falls through */
3613 case 'week':
3614 case 'isoWeek':
3615 case 'day':
3616 this.hours(0);
3617 /* falls through */
3618 case 'hour':
3619 this.minutes(0);
3620 /* falls through */
3621 case 'minute':
3622 this.seconds(0);
3623 /* falls through */
3624 case 'second':
3625 this.milliseconds(0);
3626 }
3627
3628 // weeks are a special case
3629 if (units === 'week') {
3630 this.weekday(0);
3631 }
3632 if (units === 'isoWeek') {
3633 this.isoWeekday(1);
3634 }
3635
3636 // quarters are also special
3637 if (units === 'quarter') {
3638 this.month(Math.floor(this.month() / 3) * 3);
3639 }
3640
3641 return this;
3642 }
3643
3644 function endOf (units) {
3645 units = normalizeUnits(units);

Callers

nothing calls this directly

Calls 1

normalizeUnitsFunction · 0.85

Tested by

no test coverage detected